From 16d6ce23c1a9d88987e1c1d53dc0d99d17c76994 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Mon, 16 Aug 2021 20:06:01 +0200 Subject: [PATCH] Change Humidity channel from Number to Number:Dimensionless Fixes #9755 Signed-off-by: Jacob Laursen --- bundles/org.openhab.binding.danfossairunit/README.md | 2 +- .../binding/danfossairunit/internal/DanfossAirUnit.java | 6 ++++-- .../src/main/resources/OH-INF/thing/thing-types.xml | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bundles/org.openhab.binding.danfossairunit/README.md b/bundles/org.openhab.binding.danfossairunit/README.md index 03f77b16286ba..eb92bc707e83e 100644 --- a/bundles/org.openhab.binding.danfossairunit/README.md +++ b/bundles/org.openhab.binding.danfossairunit/README.md @@ -34,7 +34,7 @@ These are the available configuration parameters: | 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 | +| 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 dd392bef2b0bd..e58cc0b743f3f 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 + @@ -175,7 +177,7 @@ - Number + Number:Dimensionless Humidity