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

@@ -53,7 +53,7 @@ import org.openhab.core.config.core.Configuration;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
@@ -431,8 +431,8 @@ public class PlugwiseRelayDeviceHandler extends AbstractPlugwiseThingHandler {
mostRecentEnergy.setInterval(configuration.getMeasurementInterval());
energy = mostRecentEnergy;
logger.trace("Updating {} ({}) energy with: {}", deviceType, macAddress, mostRecentEnergy);
updateState(CHANNEL_ENERGY, new QuantityType<>(correctSign(mostRecentEnergy.tokWh(localCalibration)),
SmartHomeUnits.KILOWATT_HOUR));
updateState(CHANNEL_ENERGY,
new QuantityType<>(correctSign(mostRecentEnergy.tokWh(localCalibration)), Units.KILOWATT_HOUR));
LocalDateTime start = mostRecentEnergy.getStart();
updateState(CHANNEL_ENERGY_STAMP,
start != null ? PlugwiseUtils.newDateTimeType(start) : UnDefType.NULL);
@@ -460,7 +460,7 @@ public class PlugwiseRelayDeviceHandler extends AbstractPlugwiseThingHandler {
return;
}
updateState(CHANNEL_POWER, new QuantityType<>(correctSign(watt), SmartHomeUnits.WATT));
updateState(CHANNEL_POWER, new QuantityType<>(correctSign(watt), Units.WATT));
}
private void handleRealTimeClockGetResponse(RealTimeClockGetResponseMessage message) {

View File

@@ -31,7 +31,7 @@ import org.openhab.binding.plugwise.internal.protocol.field.MACAddress;
import org.openhab.core.config.core.Configuration;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.Thing;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -130,7 +130,7 @@ public class PlugwiseSenseHandler extends AbstractSleepingEndDeviceHandler {
private void handleSenseReportRequestMessage(SenseReportRequestMessage message) {
updateLastSeen();
updateState(CHANNEL_HUMIDITY, new QuantityType<>(message.getHumidity().getValue(), SmartHomeUnits.PERCENT));
updateState(CHANNEL_HUMIDITY, new QuantityType<>(message.getHumidity().getValue(), Units.PERCENT));
updateState(CHANNEL_TEMPERATURE, new QuantityType<>(message.getTemperature().getValue(), SIUnits.CELSIUS));
}