Skip to content

Commit

Permalink
[tado] Change humidity and heatingPower channels to QuantityType (#16531
Browse files Browse the repository at this point in the history
)

* [tado] tweaks to xml

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
  • Loading branch information
andrewfg authored Apr 1, 2024
1 parent b3ba1df commit 7d8a1b1
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 81 deletions.
4 changes: 2 additions & 2 deletions bundles/org.openhab.binding.tado/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
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;

Expand Down Expand Up @@ -75,13 +76,14 @@ public State getInsideTemperature() {

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -36,22 +36,25 @@
<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>
Expand All @@ -60,6 +63,7 @@

<properties>
<property name="vendor">tado°</property>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>id</representation-property>

Expand Down Expand Up @@ -98,7 +102,7 @@
<description>Mobile device of a home</description>

<channels>
<channel typeId="atHome" id="atHome"></channel>
<channel typeId="atHome" id="atHome"/>
</channels>

<properties>
Expand Down Expand Up @@ -131,30 +135,22 @@
<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>
Expand All @@ -171,15 +167,15 @@
<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">
<item-type>String</item-type>
<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>
Expand Down Expand Up @@ -208,7 +204,7 @@
<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>
Expand All @@ -226,7 +222,7 @@
<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>
Expand All @@ -245,11 +241,11 @@
<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>
Expand All @@ -263,7 +259,7 @@
<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>
Expand All @@ -278,7 +274,7 @@
<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">
Expand All @@ -300,15 +296,15 @@
<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">
<item-type>Switch</item-type>
<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>
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 7d8a1b1

Please sign in to comment.