From 94d96c54ee2cd9aef2fbe9020dd73e0b275eca86 Mon Sep 17 00:00:00 2001 From: jlaur Date: Sun, 22 Aug 2021 11:52:05 +0200 Subject: [PATCH] [danfossairunit] Change Humidity channel type from Number to Number:Dimensionless (#11121) * Change Humidity channel from Number to Number:Dimensionless * Fix documentation for temperature channels. Fixes #9755 Signed-off-by: Jacob Laursen --- bundles/org.openhab.binding.danfossairunit/README.md | 8 ++++---- .../binding/danfossairunit/internal/DanfossAirUnit.java | 6 ++++-- .../src/main/resources/OH-INF/thing/thing-types.xml | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bundles/org.openhab.binding.danfossairunit/README.md b/bundles/org.openhab.binding.danfossairunit/README.md index a2b280250e0b3..fecbffced8937 100644 --- a/bundles/org.openhab.binding.danfossairunit/README.md +++ b/bundles/org.openhab.binding.danfossairunit/README.md @@ -31,10 +31,10 @@ These are the available configuration parameters: | extract_fan_step | main | Dimmer | RO | Current step setting of the fan extracting air from the rooms | | boost | main | Switch | RW | Enables fan boost | | night_cooling | main | Switch | RW | Enables night cooling | -| room_temp | temps | Number | RO | Temperature of the air in the room of the Air Dial | -| room_temp_calculated | temps | Number | RO | Calculated Room Temperature | -| outdoor_temp | temps | Number | RO | Temperature of the air outside | -| humidity | humidity | Number | RO | Humidity | +| room_temp | temps | Number:Temperature | RO | Temperature of the air in the room of the Air Dial | +| room_temp_calculated | temps | Number:Temperature | RO | Calculated Room Temperature | +| outdoor_temp | temps | Number:Temperature | RO | Temperature of the air outside | +| humidity | humidity | Number:Dimensionless | RO | Current relative humidity measured by the unit | | bypass | recuperator | Switch | RW | Disables the heat exchange. Useful in summer when room temperature is above target and outside temperature is below target. | | supply_temp | recuperator | Number | RO | Temperature of air which is passed to the rooms | | extract_temp | recuperator | Number | RO | Temperature of the air as extracted from the rooms | diff --git a/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnit.java b/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnit.java index c86e00bc6adf3..a62b09508df48 100644 --- a/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnit.java +++ b/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnit.java @@ -23,6 +23,7 @@ import java.time.ZoneId; import java.time.ZonedDateTime; +import javax.measure.quantity.Dimensionless; import javax.measure.quantity.Temperature; import org.eclipse.jdt.annotation.NonNullByDefault; @@ -33,6 +34,7 @@ import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.types.StringType; import org.openhab.core.library.unit.SIUnits; +import org.openhab.core.library.unit.Units; import org.openhab.core.types.Command; /** @@ -191,9 +193,9 @@ public OnOffType getBypass() throws IOException { return getBoolean(REGISTER_1_READ, BYPASS) ? OnOffType.ON : OnOffType.OFF; } - public DecimalType getHumidity() throws IOException { + public QuantityType getHumidity() throws IOException { BigDecimal value = BigDecimal.valueOf(asPercentByte(getByte(REGISTER_1_READ, HUMIDITY))); - return new DecimalType(value.setScale(1, RoundingMode.HALF_UP)); + return new QuantityType<>(value.setScale(1, RoundingMode.HALF_UP), Units.PERCENT); } public QuantityType getRoomTemperature() throws IOException, UnexpectedResponseValueException { diff --git a/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/thing/thing-types.xml index 8ad223236e894..d85e4fb08a049 100644 --- a/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/thing/thing-types.xml @@ -84,7 +84,9 @@ - + + Current relative humidity measured by the unit + @@ -187,7 +189,7 @@ - Number + Number:Dimensionless Humidity