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

@@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.tplinksmarthome.internal.Commands;
import org.openhab.binding.tplinksmarthome.internal.model.Realtime;
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.types.State;
import org.openhab.core.types.UnDefType;
@@ -61,16 +61,16 @@ public class EnergySwitchDevice extends SwitchDevice {
switch (channelId) {
case CHANNEL_ENERGY_CURRENT:
value = new QuantityType<>(realtime.getCurrent(), SmartHomeUnits.AMPERE);
value = new QuantityType<>(realtime.getCurrent(), Units.AMPERE);
break;
case CHANNEL_ENERGY_TOTAL:
value = new QuantityType<>(realtime.getTotal(), SmartHomeUnits.KILOWATT_HOUR);
value = new QuantityType<>(realtime.getTotal(), Units.KILOWATT_HOUR);
break;
case CHANNEL_ENERGY_VOLTAGE:
value = new QuantityType<>(realtime.getVoltage(), SmartHomeUnits.VOLT);
value = new QuantityType<>(realtime.getVoltage(), Units.VOLT);
break;
case CHANNEL_ENERGY_POWER:
value = new QuantityType<>(realtime.getPower(), SmartHomeUnits.WATT);
value = new QuantityType<>(realtime.getPower(), Units.WATT);
break;
default:
value = UnDefType.UNDEF;

View File

@@ -32,7 +32,7 @@ import org.openhab.binding.tplinksmarthome.internal.device.SmartHomeDevice;
import org.openhab.core.cache.ExpiringCache;
import org.openhab.core.config.core.Configuration;
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;
@@ -251,7 +251,7 @@ public class SmartHomeHandler extends BaseThingHandler {
if (deviceState == null) {
state = UnDefType.UNDEF;
} else if (CHANNEL_RSSI.equals(channelId)) {
state = new QuantityType<>(deviceState.getSysinfo().getRssi(), SmartHomeUnits.DECIBEL_MILLIWATTS);
state = new QuantityType<>(deviceState.getSysinfo().getRssi(), Units.DECIBEL_MILLIWATTS);
} else {
state = smartHomeDevice.updateChannel(channelUID, deviceState);
}