Skip to content

Commit

Permalink
[danfossairunit] Change Humidity channel type from Number to Number:D…
Browse files Browse the repository at this point in the history
…imensionless (openhab#11121)

* Change Humidity channel from Number to Number:Dimensionless
* Fix documentation for temperature channels.

Fixes openhab#9755

Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Thomas <[email protected]>
  • Loading branch information
jlaur authored and Thomas committed Sep 2, 2021
1 parent c48031e commit 03c613f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions bundles/org.openhab.binding.danfossairunit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/**
Expand Down Expand Up @@ -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<Dimensionless> 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<Temperature> getRoomTemperature() throws IOException, UnexpectedResponseValueException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@
<channel-group-type id="humidity">
<label>Humidity</label>
<channels>
<channel id="humidity" typeId="humidity"/>
<channel id="humidity" typeId="humidity">
<description>Current relative humidity measured by the unit</description>
</channel>
</channels>
</channel-group-type>
<channel-group-type id="recuperator">
Expand Down Expand Up @@ -187,7 +189,7 @@
<state pattern="%.0f %%" readOnly="true" min="0" max="100"/>
</channel-type>
<channel-type id="humidity">
<item-type>Number</item-type>
<item-type>Number:Dimensionless</item-type>
<label>Humidity</label>
<category>Humidity</category>
<tags>
Expand Down

0 comments on commit 03c613f

Please sign in to comment.