From bc05a8b1b6c3e76337aa8a82e473300984673daa Mon Sep 17 00:00:00 2001 From: Andrew Fiddian-Green Date: Mon, 1 Apr 2024 16:21:45 +0100 Subject: [PATCH] [tado] Change humidity and heatingPower channels to QuantityType (#16531) * [tado] tweaks to xml Signed-off-by: Andrew Fiddian-Green Signed-off-by: Ciprian Pascu --- bundles/org.openhab.binding.tado/README.md | 4 +- .../adapter/TadoZoneStateAdapter.java | 10 ++- .../resources/OH-INF/i18n/tado.properties | 63 +++++++-------- .../resources/OH-INF/thing/thing-types.xml | 76 +++++++++---------- .../resources/OH-INF/update/instructions.xml | 19 +++++ 5 files changed, 91 insertions(+), 81 deletions(-) create mode 100644 bundles/org.openhab.binding.tado/src/main/resources/OH-INF/update/instructions.xml diff --git a/bundles/org.openhab.binding.tado/README.md b/bundles/org.openhab.binding.tado/README.md index 5a8d884b33e..3debca6c1e0 100644 --- a/bundles/org.openhab.binding.tado/README.md +++ b/bundles/org.openhab.binding.tado/README.md @@ -64,13 +64,13 @@ If you are unsure, have a look at the tado° app and see if the functionality is Name | Type | Description | Read/Write | Zone type -|-|-|-|- `currentTemperature` | Number:Temperature | Current inside temperature | R | `HEATING`, `AC` -`humidity` | Number | Current relative inside humidity in percent | R | `HEATING`, `AC` +`humidity` | Number:Dimensionless | Current relative inside humidity in percent | R | `HEATING`, `AC` `hvacMode` | String | Active mode, one of `OFF`, `HEAT`, `COOL`, `DRY`, `FAN`, `AUTO` | RW | `HEATING` and `DHW` support `OFF` and `HEAT`, `AC` can support more `targetTemperature` | Number:Temperature | Set point | RW | `HEATING`, `AC`, `DHW` `operationMode` | String | Operation mode the zone is currently in. One of `SCHEDULE` (follow smart schedule), `MANUAL` (override until ended manually), `TIMER` (override for a given time), `UNTIL_CHANGE` (active until next smart schedule block or until AWAY mode becomes active) | RW | `HEATING`, `AC`, `DHW` `overlayExpiry` | DateTime | End date and time of a timer | R | `HEATING`, `AC`, `DHW` `timerDuration` | Number | Timer duration in minutes | RW | `HEATING`, `AC`, `DHW` -`heatingPower` | Number | Amount of heating power currently present | R | `HEATING` +`heatingPower` | Number:Dimensionless | Amount of heating power currently present | R | `HEATING` `acPower` | Switch | Indicates if the Air-Conditioning is Off or On | R | `AC` `fanspeed`1) | String | Fan speed, one of `AUTO`, `LOW`, `MIDDLE`, `HIGH` | RW | `AC` `fanLevel`1) | String | Fan speed, one of 3) `AUTO`, `SILENT`, `LEVEL1`, `LEVEL2`, `LEVEL3`, `LEVEL4`, `LEVEL5` | RW | `AC` diff --git a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/adapter/TadoZoneStateAdapter.java b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/adapter/TadoZoneStateAdapter.java index c6231ba1a65..e3278081fc0 100644 --- a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/adapter/TadoZoneStateAdapter.java +++ b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/adapter/TadoZoneStateAdapter.java @@ -48,6 +48,7 @@ import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.types.StringType; import org.openhab.core.library.unit.ImperialUnits; import org.openhab.core.library.unit.SIUnits; +import org.openhab.core.library.unit.Units; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; @@ -75,13 +76,14 @@ public class TadoZoneStateAdapter { public State getHumidity() { PercentageDataPoint humidity = zoneState.getSensorDataPoints().getHumidity(); - return humidity != null ? toDecimalType(humidity.getPercentage()) : UnDefType.UNDEF; + return humidity != null ? new QuantityType<>(humidity.getPercentage(), Units.PERCENT) : UnDefType.UNDEF; } - public DecimalType getHeatingPower() { + public State getHeatingPower() { ActivityDataPoints dataPoints = zoneState.getActivityDataPoints(); - return dataPoints.getHeatingPower() != null ? toDecimalType(dataPoints.getHeatingPower().getPercentage()) - : DecimalType.ZERO; + return dataPoints.getHeatingPower() != null + ? new QuantityType<>(dataPoints.getHeatingPower().getPercentage().doubleValue(), Units.PERCENT) + : UnDefType.UNDEF; } public State getAcPower() { diff --git a/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/i18n/tado.properties b/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/i18n/tado.properties index 948481443fa..69c64c98e07 100644 --- a/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/i18n/tado.properties +++ b/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/i18n/tado.properties @@ -13,6 +13,8 @@ thing-type.tado.zone.label = Zone thing-type.tado.zone.description = A zone of a home thing-type.tado.zone.channel.batteryLowAlarm.label = Battery Low Alarm thing-type.tado.zone.channel.batteryLowAlarm.description = ON if one or more devices in the zone have a low battery +thing-type.tado.zone.channel.humidity.label = Humidity +thing-type.tado.zone.channel.humidity.description = Current humidity in % # thing types config @@ -41,30 +43,35 @@ channel-type.tado.atHome.label = At Home channel-type.tado.atHome.description = ON if at home, OFF if away channel-type.tado.currentTemperature.label = Temperature channel-type.tado.currentTemperature.description = Current temperature - +channel-type.tado.fanLevel.label = Fan Speed +channel-type.tado.fanLevel.description = AC fan level (only if supported by AC) +channel-type.tado.fanLevel.state.option.SILENT = SILENT +channel-type.tado.fanLevel.state.option.LEVEL1 = LEVEL1 +channel-type.tado.fanLevel.state.option.LEVEL2 = LEVEL2 +channel-type.tado.fanLevel.state.option.LEVEL3 = LEVEL3 +channel-type.tado.fanLevel.state.option.LEVEL4 = LEVEL4 +channel-type.tado.fanLevel.state.option.LEVEL5 = LEVEL5 +channel-type.tado.fanLevel.state.option.AUTO = AUTO channel-type.tado.fanspeed.label = Fan Speed channel-type.tado.fanspeed.description = AC fan speed (only if supported by AC) channel-type.tado.fanspeed.state.option.LOW = Low channel-type.tado.fanspeed.state.option.MIDDLE = Middle channel-type.tado.fanspeed.state.option.HIGH = High channel-type.tado.fanspeed.state.option.AUTO = Auto - -channel-type.tado.fanLevel.label = Fan Level -channel-type.tado.fanLevel.description = AC fan speed (only if supported by AC) -channel-type.tado.fanLevel.state.option.SILENT = Silent fan -channel-type.tado.fanLevel.state.option.LEVEL1 = Fan level 1 -channel-type.tado.fanLevel.state.option.LEVEL2 = Fan level 2 -channel-type.tado.fanLevel.state.option.LEVEL3 = Fan level 3 -channel-type.tado.fanLevel.state.option.LEVEL4 = Fan level 4 -channel-type.tado.fanLevel.state.option.LEVEL5 = Fan level 5 -channel-type.tado.fanLevel.state.option.AUTO = Auto fan speed - channel-type.tado.heatingPower.label = Heating Power channel-type.tado.heatingPower.description = Current heating power channel-type.tado.homePresence.label = At Home channel-type.tado.homePresence.description = ON if at home, OFF if away -channel-type.tado.humidity.label = Humidity -channel-type.tado.humidity.description = Current humidity in % +channel-type.tado.horizontalSwing.label = Horizontal Swing +channel-type.tado.horizontalSwing.description = State of AC horizontal swing (only if supported by AC) +channel-type.tado.horizontalSwing.state.option.AUTO = AUTO +channel-type.tado.horizontalSwing.state.option.LEFT = LEFT +channel-type.tado.horizontalSwing.state.option.MID_LEFT = MID-LEFT +channel-type.tado.horizontalSwing.state.option.MID = MID +channel-type.tado.horizontalSwing.state.option.MID_RIGHT = MID-RIGHT +channel-type.tado.horizontalSwing.state.option.RIGHT = RIGHT +channel-type.tado.horizontalSwing.state.option.ON = ON +channel-type.tado.horizontalSwing.state.option.OFF = OFF channel-type.tado.hvacMode.label = HVAC Mode channel-type.tado.hvacMode.description = Mode of the device (OFF, HEAT, COOL, DRY, FAN, AUTO - if supported) channel-type.tado.hvacMode.state.option.OFF = Off @@ -73,6 +80,8 @@ channel-type.tado.hvacMode.state.option.COOL = Cool channel-type.tado.hvacMode.state.option.DRY = Dry channel-type.tado.hvacMode.state.option.FAN = Fan channel-type.tado.hvacMode.state.option.AUTO = Auto +channel-type.tado.light.label = Light +channel-type.tado.light.description = State of control panel light (only if supported by AC) channel-type.tado.openWindowDetected.label = Open Window Detected channel-type.tado.openWindowDetected.description = Indicates if an open window has been detected channel-type.tado.operationMode.label = Zone Operation Mode @@ -86,23 +95,12 @@ channel-type.tado.overlayExpiry.description = Time until when the overlay is act channel-type.tado.overlayExpiry.state.pattern = %1$tF %1$tR channel-type.tado.swing.label = Swing channel-type.tado.swing.description = State of AC swing (only if supported by AC) - -channel-type.tado.light.label = Light -channel-type.tado.light.description = State of control panel light (only if supported by AC) - -channel-type.tado.horizontalSwing.label = Horizontal Swing -channel-type.tado.horizontalSwing.description = State of AC Horizontal swing (only if supported by AC) -channel-type.tado.horizontalSwing.state.option.AUTO = AUTO -channel-type.tado.horizontalSwing.state.option.LEFT = LEFT -channel-type.tado.horizontalSwing.state.option.MID_LEFT = MID-LEFT -channel-type.tado.horizontalSwing.state.option.MID = MID -channel-type.tado.horizontalSwing.state.option.MID_RIGHT = MID-RIGHT -channel-type.tado.horizontalSwing.state.option.RIGHT = RIGHT -channel-type.tado.horizontalSwing.state.option.ON = ON -channel-type.tado.horizontalSwing.state.option.OFF = OFF - +channel-type.tado.targetTemperature.label = Target Temperature +channel-type.tado.targetTemperature.description = Thermostat temperature setpoint +channel-type.tado.timerDuration.label = Timer Duration +channel-type.tado.timerDuration.description = Total duration of a timer channel-type.tado.verticalSwing.label = Vertical Swing -channel-type.tado.verticalSwing.description = State of AC Vertical swing (only if supported by AC) +channel-type.tado.verticalSwing.description = State of AC vertical swing (only if supported by AC) channel-type.tado.verticalSwing.state.option.AUTO = AUTO channel-type.tado.verticalSwing.state.option.UP = UP channel-type.tado.verticalSwing.state.option.MID_UP = MID-UP @@ -111,8 +109,3 @@ channel-type.tado.verticalSwing.state.option.MID_DOWN = MID-DOWN channel-type.tado.verticalSwing.state.option.DOWN = DOWN channel-type.tado.verticalSwing.state.option.ON = ON channel-type.tado.verticalSwing.state.option.OFF = OFF - -channel-type.tado.targetTemperature.label = Target Temperature -channel-type.tado.targetTemperature.description = Thermostat temperature setpoint -channel-type.tado.timerDuration.label = Timer Duration -channel-type.tado.timerDuration.description = Total duration of a timer diff --git a/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/thing/thing-types.xml index e1dba5d2f5c..66ef5889743 100644 --- a/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/thing/thing-types.xml @@ -10,7 +10,7 @@ The user's tado home - + @@ -36,22 +36,25 @@ A zone of a home - - - - - - - - - - - - - - - - + + + + Current humidity in % + + + + + + + + + + + + + + + ON if one or more devices in the zone have a low battery @@ -60,6 +63,7 @@ tado° + 1 id @@ -98,7 +102,7 @@ Mobile device of a home - + @@ -131,30 +135,22 @@ Current temperature Temperature - - - - - Number - - Current humidity in % - Humidity - + - Number + Number:Dimensionless Current heating power Fire - + String Mode of the device (OFF, HEAT, COOL, DRY, FAN, AUTO - if supported) - + @@ -171,7 +167,7 @@ Thermostat temperature setpoint Temperature - + @@ -179,7 +175,7 @@ AC fan speed (only if supported by AC) Fan - + @@ -208,7 +204,7 @@ AC fan level (only if supported by AC) Fan - + @@ -226,7 +222,7 @@ State of AC horizontal swing (only if supported by AC) Flow - + @@ -245,11 +241,11 @@ State of AC vertical swing (only if supported by AC) Flow - + - + @@ -263,7 +259,7 @@ String Active operation mode (schedule, manual, timer or until next change) - + @@ -278,7 +274,7 @@ Total duration of a timer Time - + @@ -300,7 +296,7 @@ Current power state of the air-conditioning Climate - + @@ -308,7 +304,7 @@ Indicates if an open window has been detected Window - + diff --git a/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/update/instructions.xml new file mode 100644 index 00000000000..4cbe82b0ccb --- /dev/null +++ b/bundles/org.openhab.binding.tado/src/main/resources/OH-INF/update/instructions.xml @@ -0,0 +1,19 @@ + + + + + + + tado:heatingPower + + + system:atmospheric-humidity + + Current humidity in % + + + + +