]> git.basschouten.com Git - openhab-addons.git/commitdiff
[tado] Change humidity and heatingPower channels to QuantityType (#16531)
authorAndrew Fiddian-Green <software@whitebear.ch>
Mon, 1 Apr 2024 15:21:45 +0000 (16:21 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Apr 2024 15:21:45 +0000 (17:21 +0200)
* [tado] tweaks to xml

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
bundles/org.openhab.binding.tado/README.md
bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/adapter/TadoZoneStateAdapter.java
bundles/org.openhab.binding.tado/src/main/resources/OH-INF/i18n/tado.properties
bundles/org.openhab.binding.tado/src/main/resources/OH-INF/thing/thing-types.xml
bundles/org.openhab.binding.tado/src/main/resources/OH-INF/update/instructions.xml [new file with mode: 0644]

index 5a8d884b33e7647b000374cf36c5224ab6109e94..3debca6c1e0acdfe0184658726e993c7edfda821 100644 (file)
@@ -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`<sup>1)</sup> | String | Fan speed, one of `AUTO`, `LOW`, `MIDDLE`, `HIGH` | RW | `AC`
 `fanLevel`<sup>1)</sup> | String | Fan speed, one of <sup>3)</sup> `AUTO`, `SILENT`, `LEVEL1`, `LEVEL2`, `LEVEL3`, `LEVEL4`, `LEVEL5` | RW | `AC`
index c6231ba1a654240b7eb6049f3d549146561aa982..e3278081fc0948f642aa27a50fa1a8c0892c5dc0 100644 (file)
@@ -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() {
index 948481443fab5272e2175aca716ccbc6a2613f7a..69c64c98e0778ba2131c9f2b37635e2b675bcb17 100644 (file)
@@ -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
index e1dba5d2f5c7d0b13a4c8df3946612607a894fbb..66ef58897432c39f6aafd13531d963c2ae6f5497 100644 (file)
@@ -10,7 +10,7 @@
                <description>The user's tado home</description>
 
                <channels>
-                       <channel typeId="homePresence" id="homePresence"></channel>
+                       <channel typeId="homePresence" id="homePresence"/>
                </channels>
 
                <config-description>
                <description>A zone of a home</description>
 
                <channels>
-                       <channel typeId="currentTemperature" id="currentTemperature"></channel>
-                       <channel typeId="humidity" id="humidity"></channel>
-                       <channel typeId="heatingPower" id="heatingPower"></channel>
-                       <channel typeId="acPower" id="acPower"></channel>
-                       <channel typeId="fanspeed" id="fanspeed"></channel>
-                       <channel typeId="fanLevel" id="fanLevel"></channel>
-                       <channel typeId="swing" id="swing"></channel>
-                       <channel typeId="horizontalSwing" id="horizontalSwing"></channel>
-                       <channel typeId="verticalSwing" id="verticalSwing"></channel>
-                       <channel typeId="light" id="light"></channel>
-                       <channel typeId="hvacMode" id="hvacMode"></channel>
-                       <channel typeId="targetTemperature" id="targetTemperature"></channel>
-                       <channel typeId="operationMode" id="operationMode"></channel>
-                       <channel typeId="overlayExpiry" id="overlayExpiry"></channel>
-                       <channel typeId="timerDuration" id="timerDuration"></channel>
-                       <channel typeId="openWindowDetected" id="openWindowDetected"></channel>
+                       <channel typeId="currentTemperature" id="currentTemperature"/>
+                       <channel typeId="system.atmospheric-humidity" id="humidity">
+                               <label>Humidity</label>
+                               <description>Current humidity in %</description>
+                       </channel>
+                       <channel typeId="heatingPower" id="heatingPower"/>
+                       <channel typeId="acPower" id="acPower"/>
+                       <channel typeId="fanspeed" id="fanspeed"/>
+                       <channel typeId="fanLevel" id="fanLevel"/>
+                       <channel typeId="swing" id="swing"/>
+                       <channel typeId="horizontalSwing" id="horizontalSwing"/>
+                       <channel typeId="verticalSwing" id="verticalSwing"/>
+                       <channel typeId="light" id="light"/>
+                       <channel typeId="hvacMode" id="hvacMode"/>
+                       <channel typeId="targetTemperature" id="targetTemperature"/>
+                       <channel typeId="operationMode" id="operationMode"/>
+                       <channel typeId="overlayExpiry" id="overlayExpiry"/>
+                       <channel typeId="timerDuration" id="timerDuration"/>
+                       <channel typeId="openWindowDetected" id="openWindowDetected"/>
                        <channel typeId="system.low-battery" id="batteryLowAlarm">
                                <label>Battery Low Alarm</label>
                                <description>ON if one or more devices in the zone have a low battery</description>
@@ -60,6 +63,7 @@
 
                <properties>
                        <property name="vendor">tado°</property>
+                       <property name="thingTypeVersion">1</property>
                </properties>
                <representation-property>id</representation-property>
 
                <description>Mobile device of a home</description>
 
                <channels>
-                       <channel typeId="atHome" id="atHome"></channel>
+                       <channel typeId="atHome" id="atHome"/>
                </channels>
 
                <properties>
                <label>Temperature</label>
                <description>Current temperature</description>
                <category>Temperature</category>
-               <state readOnly="true" pattern="%.1f %unit%"></state>
-       </channel-type>
-
-       <channel-type id="humidity">
-               <item-type>Number</item-type>
-               <label>Humidity</label>
-               <description>Current humidity in %</description>
-               <category>Humidity</category>
-               <state readOnly="true" pattern="%.1f %%"></state>
+               <state readOnly="true" pattern="%.1f %unit%"/>
        </channel-type>
 
        <channel-type id="heatingPower">
-               <item-type>Number</item-type>
+               <item-type>Number:Dimensionless</item-type>
                <label>Heating Power</label>
                <description>Current heating power</description>
                <category>Fire</category>
-               <state readOnly="true" pattern="%.0f %%"></state>
+               <state readOnly="true" pattern="%.0f %%"/>
        </channel-type>
 
        <channel-type id="hvacMode">
                <item-type>String</item-type>
                <label>HVAC Mode</label>
                <description>Mode of the device (OFF, HEAT, COOL, DRY, FAN, AUTO - if supported)</description>
-               <state readOnly="false">
+               <state>
                        <options>
                                <option value="OFF">Off</option>
                                <option value="HEAT">Heat</option>
                <label>Target Temperature</label>
                <description>Thermostat temperature setpoint</description>
                <category>Temperature</category>
-               <state step="0.1" pattern="%.1f %unit%" readOnly="false"></state>
+               <state step="0.1" pattern="%.1f %unit%"/>
        </channel-type>
 
        <channel-type id="fanspeed">
                <label>Fan Speed</label>
                <description>AC fan speed (only if supported by AC)</description>
                <category>Fan</category>
-               <state readOnly="false">
+               <state>
                        <options>
                                <option value="LOW">Low</option>
                                <option value="MIDDLE">Middle</option>
                <label>Fan Speed</label>
                <description>AC fan level (only if supported by AC)</description>
                <category>Fan</category>
-               <state readOnly="false">
+               <state>
                        <options>
                                <option value="SILENT">SILENT</option>
                                <option value="LEVEL1">LEVEL1</option>
                <label>Horizontal Swing</label>
                <description>State of AC horizontal swing (only if supported by AC)</description>
                <category>Flow</category>
-               <state readOnly="false">
+               <state>
                        <options>
                                <option value="AUTO">AUTO</option>
                                <option value="LEFT">LEFT</option>
                <label>Vertical Swing</label>
                <description>State of AC vertical swing (only if supported by AC)</description>
                <category>Flow</category>
-               <state readOnly="false">
+               <state>
                        <options>
                                <option value="AUTO">AUTO</option>
                                <option value="UP">UP</option>
-                               <option value="MID_UP">UP</option>
+                               <option value="MID_UP">MID-UP</option>
                                <option value="MID">MID</option>
                                <option value="MID_DOWN">MID-DOWN</option>
                                <option value="DOWN">DOWN</option>
                <item-type>String</item-type>
                <label>Zone Operation Mode</label>
                <description>Active operation mode (schedule, manual, timer or until next change)</description>
-               <state readOnly="false">
+               <state>
                        <options>
                                <option value="SCHEDULE">Schedule</option>
                                <option value="MANUAL">Manual</option>
                <label>Timer Duration</label>
                <description>Total duration of a timer</description>
                <category>Time</category>
-               <state min="0" step="1" pattern="%d min" readOnly="false"></state>
+               <state min="0" step="1" pattern="%d min"/>
        </channel-type>
 
        <channel-type id="overlayExpiry">
                <label>Air-conditioning Power</label>
                <description>Current power state of the air-conditioning</description>
                <category>Climate</category>
-               <state readOnly="true"></state>
+               <state readOnly="true"/>
        </channel-type>
 
        <channel-type id="openWindowDetected">
                <label>Open Window Detected</label>
                <description>Indicates if an open window has been detected</description>
                <category>Window</category>
-               <state readOnly="true"></state>
+               <state readOnly="true"/>
        </channel-type>
 
 </thing:thing-descriptions>
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 (file)
index 0000000..4cbe82b
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
+       xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
+
+       <thing-type uid="tado:zone">
+               <instruction-set targetVersion="1">
+                       <update-channel id="heatingPower">
+                               <type>tado:heatingPower</type>
+                       </update-channel>
+                       <update-channel id="humidity">
+                               <type>system:atmospheric-humidity</type>
+                               <label>Humidity</label>
+                               <description>Current humidity in %</description>
+                       </update-channel>
+               </instruction-set>
+       </thing-type>
+
+</update:update-descriptions>