Skip to content

Commit

Permalink
Add UoM support for rotational speed channels
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
  • Loading branch information
jlaur committed May 17, 2023
1 parent 353c154 commit 9a7588a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Frequency> 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<Frequency> getExtractFanSpeed() throws IOException {
return new QuantityType<>(BigDecimal.valueOf(getWord(REGISTER_4_READ, EXTRACT_FAN_SPEED)), Units.RPM);
}

public PercentType getSupplyFanStep() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package org.openhab.binding.danfossairunit.internal;

import java.util.Collections;
import java.util.Set;

import org.eclipse.jdt.annotation.NonNullByDefault;
Expand All @@ -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<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_AIRUNIT);
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_AIRUNIT);
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,18 @@
<state step="10" min="0" max="100"/>
</channel-type>
<channel-type id="supplyFanSpeed">
<item-type>Number</item-type>
<item-type>Number:Frequency</item-type>
<label>Supply Fan Speed</label>
<description>Current rotation of the fan supplying air to the rooms</description>
<category>Fan</category>
<state pattern="%.0f rpm" readOnly="true" min="0"/>
<state pattern="%.0f %unit%" readOnly="true" min="0"/>
</channel-type>
<channel-type id="extractFanSpeed">
<item-type>Number</item-type>
<item-type>Number:Frequency</item-type>
<label>Extract Fan Speed</label>
<description>Current rotation of the fan extracting air from the rooms</description>
<category>Fan</category>
<state pattern="%.0f rpm" readOnly="true" min="0"/>
<state pattern="%.0f %unit%" readOnly="true" min="0"/>
</channel-type>
<channel-type id="supplyFanStep">
<item-type>Dimmer</item-type>
Expand Down

0 comments on commit 9a7588a

Please sign in to comment.