[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>
pull/11145/head
jlaur 2021-08-22 11:52:05 +02:00 committed by GitHub
parent 44538c5409
commit 9fed16d8bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

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

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>