diff --git a/bundles/org.openhab.binding.danfossairunit/README.md b/bundles/org.openhab.binding.danfossairunit/README.md index 49d7d3a6e97..4869d793583 100644 --- a/bundles/org.openhab.binding.danfossairunit/README.md +++ b/bundles/org.openhab.binding.danfossairunit/README.md @@ -20,28 +20,28 @@ These are the available configuration parameters: ## Channels -| channel | channel group | type | readable only (RO) or writable (RW) | description | -|---|---|---|---|---| -| current_time | main | DateTime | RO | Current time reported by the air unit. | -| mode | main | String | RW | Value to control the operation mode of the air unit. One of DEMAND, PROGRAM, MANUAL and OFF | -| manual_fan_step | main | Dimmer | RW | Value to control the fan step when in MANUAL mode (10 steps) | -| supply_fan_speed | main | Number | RO | Current rotation of the fan supplying air to the rooms (in rpm) | -| extract_fan_speed | main | Number | RO | Current rotation of the fan extracting air from the rooms (in rpm) | -| supply_fan_step | main | Dimmer | RO | Current step setting of the fan supplying air to the rooms | -| 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: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 air 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 | -| exhaust_temp | recuperator | Number | RO | Temperature of the air when pushed outside | -| battery_life | service | Number | RO | Remaining Air Dial Battery Level (percentage) | -| filter_life | service | Number | RO | Remaining life of filter until exchange is necessary (percentage) | -| filter_period | service | Number | RW | Number of months between filter replacements (between 3 and 12). This value affects calculation of filter_life by the unit, and might get overwritten by Air Dial or Link CC Controller. | +| channel | channel group | type | readable only (RO) or writable (RW) | description | +|----------------------|---------------|----------------------|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| current_time | main | DateTime | RO | Current time reported by the air unit. | +| mode | main | String | RW | Value to control the operation mode of the air unit. One of DEMAND, PROGRAM, MANUAL and OFF | +| manual_fan_step | main | Dimmer | RW | Value to control the fan step when in MANUAL mode (10 steps) | +| supply_fan_speed | main | Number:Frequency | RO | Current rotation of the fan supplying air to the rooms (in rpm) | +| extract_fan_speed | main | Number:Frequency | RO | Current rotation of the fan extracting air from the rooms (in rpm) | +| supply_fan_step | main | Dimmer | RO | Current step setting of the fan supplying air to the rooms | +| 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: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 air 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 | +| exhaust_temp | recuperator | Number | RO | Temperature of the air when pushed outside | +| battery_life | service | Number | RO | Remaining Air Dial Battery Level (percentage) | +| filter_life | service | Number | RO | Remaining life of filter until exchange is necessary (percentage) | +| filter_period | service | Number | RW | Number of months between filter replacements (between 3 and 12). This value affects calculation of filter_life by the unit, and might get overwritten by Air Dial or Link CC Controller. | ## Full Example @@ -63,12 +63,12 @@ updateUnchangedValuesEveryMillis=30000] ### Items ```java -Dimmer DanfossHRV_ManualFanStep "Manual Fan Step [%s]" {channel = "danfossairunit:airunit:myairunit:main#manual_fan_step"} -Number DanfossHRV_SupplyFanSpeed "Supply Fan Speed" {channel = "danfossairunit:airunit:myairunit:main#supply_fan_speed"} -Number DanfossHRV_ExtractFanSpeed "Extract Fan Speed" {channel = "danfossairunit:airunit:myairunit:main#extract_fan_speed"} -String DanfossHRV_Mode "Operation Mode" {channel = "danfossairunit:airunit:myairunit:main#mode"} -Switch DanfossHRV_Boost "Boost" {channel = "danfossairunit:airunit:myairunit:main#boost"} -Switch DanfossHRV_Bypass "Bypass" {channel = "danfossairunit:airunit:myairunit:recuperator#bypass"} +Dimmer DanfossHRV_ManualFanStep "Manual Fan Step [%s]" { channel = "danfossairunit:airunit:myairunit:main#manual_fan_step" } +Number:Frequency DanfossHRV_SupplyFanSpeed "Supply Fan Speed" { channel = "danfossairunit:airunit:myairunit:main#supply_fan_speed", unit="rpm" } +Number:Frequency DanfossHRV_ExtractFanSpeed "Extract Fan Speed" { channel = "danfossairunit:airunit:myairunit:main#extract_fan_speed", unit="rpm" } +String DanfossHRV_Mode "Operation Mode" { channel = "danfossairunit:airunit:myairunit:main#mode" } +Switch DanfossHRV_Boost "Boost" { channel = "danfossairunit:airunit:myairunit:main#boost" } +Switch DanfossHRV_Bypass "Bypass" { channel = "danfossairunit:airunit:myairunit:recuperator#bypass" } Number:Dimensionless DanfossHRV_Humidity "Relative humidity" { channel = "danfossairunit:airunit:myairunit:humidity#humidity" } Number:Temperature DanfossHRV_RoomTemperature "Room air temperatuyre" { channel = "danfossairunit:airunit:myairunit:temps#room_temp" } Number:Temperature DanfossHRV_OutdoorTemperature "Outdoor air temperature" { channel = "danfossairunit:airunit:myairunit:temps#outdoor_temp" } 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 565c2714ed1..576130bd53f 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.Frequency; import javax.measure.quantity.Temperature; import org.eclipse.jdt.annotation.NonNullByDefault; @@ -144,12 +145,12 @@ public class DanfossAirUnit { return new PercentType(BigDecimal.valueOf(value * 10)); } - public DecimalType getSupplyFanSpeed() throws IOException { - return new DecimalType(BigDecimal.valueOf(getWord(REGISTER_4_READ, SUPPLY_FAN_SPEED))); + public QuantityType getSupplyFanSpeed() throws IOException { + return new QuantityType<>(BigDecimal.valueOf(getWord(REGISTER_4_READ, SUPPLY_FAN_SPEED)), Units.RPM); } - public DecimalType getExtractFanSpeed() throws IOException { - return new DecimalType(BigDecimal.valueOf(getWord(REGISTER_4_READ, EXTRACT_FAN_SPEED))); + public QuantityType getExtractFanSpeed() throws IOException { + return new QuantityType<>(BigDecimal.valueOf(getWord(REGISTER_4_READ, EXTRACT_FAN_SPEED)), Units.RPM); } public PercentType getSupplyFanStep() throws IOException { diff --git a/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitBindingConstants.java b/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitBindingConstants.java index 535c8130de4..8724a742832 100644 --- a/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitBindingConstants.java +++ b/bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitBindingConstants.java @@ -12,7 +12,6 @@ */ package org.openhab.binding.danfossairunit.internal; -import java.util.Collections; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; @@ -34,5 +33,5 @@ public class DanfossAirUnitBindingConstants { public static final ThingTypeUID THING_TYPE_AIRUNIT = new ThingTypeUID(BINDING_ID, "airunit"); // The thing type as a set - public static final Set SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_AIRUNIT); + public static final Set SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_AIRUNIT); } 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 d2be979b0df..c35320b94e2 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 @@ -18,7 +18,7 @@ Danfoss - 1 + 2 host @@ -159,14 +159,14 @@ - Number + Number:Frequency Current rotation of the fan supplying air to the rooms Fan - Number + Number:Frequency Current rotation of the fan extracting air from the rooms Fan diff --git a/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/update/instructions.xml index 93796e0db2b..783f5c8f201 100644 --- a/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/update/instructions.xml +++ b/bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/update/instructions.xml @@ -9,6 +9,16 @@ + + + danfossairunit:supplyFanSpeed + + + + danfossairunit:extractFanSpeed + + + diff --git a/bundles/org.openhab.binding.danfossairunit/src/test/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitTest.java b/bundles/org.openhab.binding.danfossairunit/src/test/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitTest.java index 5c5654f0e60..5caa10704cd 100644 --- a/bundles/org.openhab.binding.danfossairunit/src/test/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitTest.java +++ b/bundles/org.openhab.binding.danfossairunit/src/test/java/org/openhab/binding/danfossairunit/internal/DanfossAirUnitTest.java @@ -30,6 +30,7 @@ import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.PercentType; import org.openhab.core.library.types.QuantityType; +import org.openhab.core.library.unit.Units; import org.openhab.core.test.java.JavaTest; /** @@ -146,6 +147,14 @@ public class DanfossAirUnitTest extends JavaTest { assertEquals(new PercentType(50), airUnit.getManualFanStep()); } + @Test + public void getSupplyFanSpeedIsReturnedAsRPM() throws IOException { + byte[] response = new byte[] { (byte) 0x04, (byte) 0xda }; + when(this.communicationController.sendRobustRequest(REGISTER_4_READ, SUPPLY_FAN_SPEED)).thenReturn(response); + var airUnit = new DanfossAirUnit(communicationController); + assertEquals(new QuantityType<>(1242, Units.RPM), airUnit.getSupplyFanSpeed()); + } + @Test public void getManualFanStepWhenOutOfRangeThrows() throws IOException { byte[] response = new byte[] { (byte) 0x0b };