From 9a7588a348b9a9184c3ef2f59cd9243a04c020a2 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Wed, 17 May 2023 17:55:10 +0200 Subject: [PATCH] Add UoM support for rotational speed channels Signed-off-by: Jacob Laursen --- .../binding/danfossairunit/internal/DanfossAirUnit.java | 9 +++++---- .../internal/DanfossAirUnitBindingConstants.java | 3 +-- .../src/main/resources/OH-INF/thing/thing-types.xml | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) 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 565c2714ed19b..576130bd53ffc 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.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 PercentType getManualFanStep() throws IOException, UnexpectedResponseValu 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 535c8130de460..8724a74283205 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 d2be979b0dfda..d046afd2c47fe 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 @@ -159,18 +159,18 @@ - 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 - + Dimmer