[danfossairunit] Change Humidity channel type from Number to Number:Dimensionless (#11121)

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

Fixes #9755

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
jlaur
2021-08-22 11:52:05 +02:00
committed by GitHub
parent 44538c5409
commit 9fed16d8bb
3 changed files with 12 additions and 8 deletions

View File

@@ -23,6 +23,7 @@ import java.time.DateTimeException;
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.PercentType;
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 class DanfossAirUnit {
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 {

View File

@@ -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">
@@ -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>