Use renamed Units class (#9267)

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-12-07 10:34:02 +01:00
committed by GitHub
parent d0480d0f2e
commit ac6f08908f
208 changed files with 1087 additions and 1169 deletions

View File

@@ -36,7 +36,7 @@ import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.MetricPrefix;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
@@ -98,7 +98,7 @@ public class NetworkHandler extends BaseThingHandler
case CHANNEL_DEPRECATED_TIME:
presenceDetection.getValue(value -> {
updateState(CHANNEL_LATENCY,
new QuantityType<>(value.getLowestLatency(), MetricPrefix.MILLI(SmartHomeUnits.SECOND)));
new QuantityType<>(value.getLowestLatency(), MetricPrefix.MILLI(Units.SECOND)));
updateState(CHANNEL_DEPRECATED_TIME, new DecimalType(value.getLowestLatency()));
});
break;
@@ -129,8 +129,7 @@ public class NetworkHandler extends BaseThingHandler
@Override
public void partialDetectionResult(PresenceDetectionValue value) {
updateState(CHANNEL_ONLINE, OnOffType.ON);
updateState(CHANNEL_LATENCY,
new QuantityType<>(value.getLowestLatency(), MetricPrefix.MILLI(SmartHomeUnits.SECOND)));
updateState(CHANNEL_LATENCY, new QuantityType<>(value.getLowestLatency(), MetricPrefix.MILLI(Units.SECOND)));
updateState(CHANNEL_DEPRECATED_TIME, new DecimalType(value.getLowestLatency()));
}

View File

@@ -13,7 +13,7 @@
package org.openhab.binding.network.internal.handler;
import static org.openhab.binding.network.internal.NetworkBindingConstants.*;
import static org.openhab.core.library.unit.SmartHomeUnits.*;
import static org.openhab.core.library.unit.Units.*;
import java.math.BigDecimal;
import java.util.concurrent.ScheduledFuture;
@@ -26,7 +26,7 @@ import org.openhab.core.library.dimension.DataTransferRate;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
@@ -77,7 +77,7 @@ public class SpeedTestHandler extends BaseThingHandler implements ISpeedTestList
updateState(CHANNEL_TEST_ISRUNNING, OnOffType.ON);
updateState(CHANNEL_TEST_START, new DateTimeType());
updateState(CHANNEL_TEST_END, UnDefType.NULL);
updateProgress(new QuantityType<>(0, SmartHomeUnits.PERCENT));
updateProgress(new QuantityType<>(0, Units.PERCENT));
socket.startDownload(configuration.getDownloadURL());
} else {
logger.info("A speedtest is already in progress, will retry on next refresh");
@@ -153,7 +153,7 @@ public class SpeedTestHandler extends BaseThingHandler implements ISpeedTestList
@Override
public void onProgress(float percent, @Nullable SpeedTestReport testReport) {
updateProgress(new QuantityType<>(Math.round(percent), SmartHomeUnits.PERCENT));
updateProgress(new QuantityType<>(Math.round(percent), Units.PERCENT));
}
private void updateProgress(State state) {