diff --git a/addons/binding/org.openhab.binding.draytonwiser/ESH-INF/thing/thing-types.xml b/addons/binding/org.openhab.binding.draytonwiser/ESH-INF/thing/thing-types.xml index b7146ee36c594..179aba6a1c48e 100644 --- a/addons/binding/org.openhab.binding.draytonwiser/ESH-INF/thing/thing-types.xml +++ b/addons/binding/org.openhab.binding.draytonwiser/ESH-INF/thing/thing-types.xml @@ -267,17 +267,17 @@ - Number + Number:ElectricPotential Current Battery Voltage for the device - + - Number + Number:Dimensionless Current heat demand in % - + @@ -330,10 +330,10 @@ - Number + Number:Dimensionless Current heat demand in % - + diff --git a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/ControllerHandler.java b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/ControllerHandler.java index 5ef3e7faf4515..1a8130bffdbcc 100644 --- a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/ControllerHandler.java +++ b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/ControllerHandler.java @@ -14,7 +14,9 @@ import org.eclipse.jdt.annotation.Nullable; import org.eclipse.smarthome.core.library.types.DecimalType; import org.eclipse.smarthome.core.library.types.OnOffType; +import org.eclipse.smarthome.core.library.types.QuantityType; import org.eclipse.smarthome.core.library.types.StringType; +import org.eclipse.smarthome.core.library.unit.SmartHomeUnits; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingStatus; @@ -173,7 +175,7 @@ private State getSignalStrength() { @SuppressWarnings("null") private State getHeatChannel1Demand() { if (heatingChannels != null && heatingChannels.size() >= 1) { - return new DecimalType(heatingChannels.get(0).getPercentageDemand()); + return new QuantityType<>(heatingChannels.get(0).getPercentageDemand(), SmartHomeUnits.PERCENT); } return UnDefType.UNDEF; @@ -182,7 +184,7 @@ private State getHeatChannel1Demand() { @SuppressWarnings("null") private State getHeatChannel2Demand() { if (heatingChannels != null && heatingChannels.size() >= 2) { - return new DecimalType(heatingChannels.get(1).getPercentageDemand()); + return new QuantityType<>(heatingChannels.get(1).getPercentageDemand(), SmartHomeUnits.PERCENT); } return UnDefType.UNDEF; diff --git a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomHandler.java b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomHandler.java index 25e6ca8703047..042561b5c6962 100644 --- a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomHandler.java +++ b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomHandler.java @@ -16,6 +16,7 @@ import org.eclipse.smarthome.core.library.types.QuantityType; import org.eclipse.smarthome.core.library.types.StringType; import org.eclipse.smarthome.core.library.unit.SIUnits; +import org.eclipse.smarthome.core.library.unit.SmartHomeUnits; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingStatus; @@ -171,7 +172,7 @@ private State getTemperature() { private State getDemand() { if (room != null) { - return new DecimalType(room.getPercentageDemand()); + return new QuantityType<>(room.getPercentageDemand(), SmartHomeUnits.PERCENT); } return UnDefType.UNDEF; diff --git a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomStatHandler.java b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomStatHandler.java index 72fdb64458bf8..94e0046fc37e4 100644 --- a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomStatHandler.java +++ b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/RoomStatHandler.java @@ -15,6 +15,7 @@ import org.eclipse.smarthome.core.library.types.QuantityType; import org.eclipse.smarthome.core.library.types.StringType; import org.eclipse.smarthome.core.library.unit.SIUnits; +import org.eclipse.smarthome.core.library.unit.SmartHomeUnits; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingStatus; @@ -189,7 +190,7 @@ private State getBatteryVoltage() { if (roomStat != null && bridgeHandler != null) { Device device = bridgeHandler.getExtendedDeviceProperties(roomStat.getId()); if (device != null) { - return new DecimalType((float) device.getBatteryVoltage() / 10); + return new QuantityType<>((float) device.getBatteryVoltage() / 10, SmartHomeUnits.VOLT); } } diff --git a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/TRVHandler.java b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/TRVHandler.java index 8b76c1f58ecd1..3ab32b7ae67aa 100644 --- a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/TRVHandler.java +++ b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/handler/TRVHandler.java @@ -15,6 +15,7 @@ import org.eclipse.smarthome.core.library.types.QuantityType; import org.eclipse.smarthome.core.library.types.StringType; import org.eclipse.smarthome.core.library.unit.SIUnits; +import org.eclipse.smarthome.core.library.unit.SmartHomeUnits; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingStatus; @@ -123,7 +124,7 @@ private State getSetPoint() { private State getDemand() { if (smartValve != null) { - return new DecimalType(smartValve.getPercentageDemand()); + return new QuantityType<>(smartValve.getPercentageDemand(), SmartHomeUnits.PERCENT); } return UnDefType.UNDEF; } @@ -189,7 +190,7 @@ private State getBatteryVoltage() { if (smartValve != null && bridgeHandler != null) { Device device = bridgeHandler.getExtendedDeviceProperties(smartValve.getId()); if (device != null) { - return new DecimalType((float) device.getBatteryVoltage() / 10); + return new QuantityType<>((float) device.getBatteryVoltage() / 10, SmartHomeUnits.VOLT); } }