[tado] Add channel for remaining time of open window override (#17576)

* [tado] Add open window override remaining time channel

Signed-off-by: AndrewFG <software@whitebear.ch>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Andrew Fiddian-Green 2024-10-21 22:55:50 +01:00 committed by Ciprian Pascu
parent cb445d4e07
commit a146c81406
7 changed files with 41 additions and 2 deletions

View File

@ -79,7 +79,8 @@ Name | Type | Description | Read/Write | Zone type
`verticalSwing`<sup>2)</sup> | String | Vertical swing state, one of <sup>3)</sup> `OFF`, `ON`, `UP`, `MID_UP`, `MID`, `MID_DOWN`, `DOWN`, `AUTO` | RW | `AC`
`horizontalSwing`<sup>2)</sup> | String | Horizontal swing state, one of <sup>3)</sup> `OFF`, `ON`, `LEFT`, `MID_LEFT`, `MID`, `MID_RIGHT`, `RIGHT`, `AUTO` | RW | `AC`
`batteryLowAlarm` | Switch | A control device in the Zone has a low battery | R | Any Zone
`openWindowDetected` | Switch | An open window has been detected in the Zone | R | Any Zone
`openWindowDetected` | Switch | An open window has been detected in the Zone | R | `HEATING`, `AC`
`openWindowRemainingTime` | Number:Time | The remaining Open Window heating/cooling Override time in the Zone | R | `HEATING`, `AC`
`light` | Switch | State (`ON`, `OFF`) of the control panel light | RW | `AC`
You will see some of the above mentioned Channels only if your tado° device supports the respective function.

View File

@ -130,6 +130,8 @@ public class TadoBindingConstants {
public static final String CHANNEL_ZONE_BATTERY_LOW_ALARM = "batteryLowAlarm";
// open window detected channel
public static final String CHANNEL_ZONE_OPEN_WINDOW_DETECTED = "openWindowDetected";
// open window heating/cooling override remaining time channel
public static final String CHANNEL_ZONE_OPEN_WINDOW_REMAINING_TIME = "openWindowRemainingTime";
public static final String CHANNEL_MOBILE_DEVICE_AT_HOME = "atHome";

View File

@ -31,6 +31,7 @@ import org.openhab.binding.tado.swagger.codegen.api.model.CoolingZoneSetting;
import org.openhab.binding.tado.swagger.codegen.api.model.GenericZoneSetting;
import org.openhab.binding.tado.swagger.codegen.api.model.HeatingZoneSetting;
import org.openhab.binding.tado.swagger.codegen.api.model.HotWaterZoneSetting;
import org.openhab.binding.tado.swagger.codegen.api.model.OpenWindow;
import org.openhab.binding.tado.swagger.codegen.api.model.Overlay;
import org.openhab.binding.tado.swagger.codegen.api.model.OverlayTerminationConditionType;
import org.openhab.binding.tado.swagger.codegen.api.model.PercentageDataPoint;
@ -262,6 +263,18 @@ public class TadoZoneStateAdapter {
return OnOffType.OFF;
}
public State getOpenWindowRemainingTime() {
int seconds = 0;
OpenWindow openWindow = zoneState.getOpenWindow();
if (openWindow != null) {
Integer remainingSeconds = openWindow.getRemainingTimeInSeconds();
if (remainingSeconds != 0) {
seconds = remainingSeconds.intValue();
}
}
return new QuantityType<>(seconds, Units.SECOND);
}
public State getLight() {
if (zoneState.getSetting().getType() == TadoSystemType.AIR_CONDITIONING) {
Power result = ((CoolingZoneSetting) zoneState.getSetting()).getLight();

View File

@ -350,6 +350,9 @@ public class TadoZoneHandler extends BaseHomeThingHandler {
updateState(TadoBindingConstants.CHANNEL_ZONE_OPEN_WINDOW_DETECTED, state.getOpenWindowDetected());
updateState(TadoBindingConstants.CHANNEL_ZONE_OPEN_WINDOW_REMAINING_TIME,
state.getOpenWindowRemainingTime());
updateDynamicStateDescriptions(zoneState);
onSuccessfulOperation();
@ -514,6 +517,8 @@ public class TadoZoneHandler extends BaseHomeThingHandler {
capabilitiesSupport.batteryLowAlarm());
removeListProcessChannel(removeList, TadoBindingConstants.CHANNEL_ZONE_OPEN_WINDOW_DETECTED,
capabilitiesSupport.openWindow());
removeListProcessChannel(removeList, TadoBindingConstants.CHANNEL_ZONE_OPEN_WINDOW_REMAINING_TIME,
capabilitiesSupport.openWindow());
removeListProcessChannel(removeList, TadoBindingConstants.CHANNEL_ZONE_LIGHT, capabilitiesSupport.light());
removeListProcessChannel(removeList, TadoBindingConstants.CHANNEL_ZONE_HORIZONTAL_SWING,
capabilitiesSupport.horizontalSwing());

View File

@ -84,6 +84,8 @@ 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.openWindowRemainingTime.label = Override Remaining Time
channel-type.tado.openWindowRemainingTime.description = The remaining Open Window heating/cooling Override time in the Zone
channel-type.tado.operationMode.label = Zone Operation Mode
channel-type.tado.operationMode.description = Active operation mode (schedule, manual, timer or until next change)
channel-type.tado.operationMode.state.option.SCHEDULE = Schedule

View File

@ -55,6 +55,7 @@
<channel typeId="overlayExpiry" id="overlayExpiry"/>
<channel typeId="timerDuration" id="timerDuration"/>
<channel typeId="openWindowDetected" id="openWindowDetected"/>
<channel typeId="openWindowRemainingTime" id="openWindowRemainingTime"/>
<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>
@ -63,7 +64,7 @@
<properties>
<property name="vendor">tado°</property>
<property name="thingTypeVersion">1</property>
<property name="thingTypeVersion">2</property>
</properties>
<representation-property>id</representation-property>
@ -307,4 +308,12 @@
<state readOnly="true"/>
</channel-type>
<channel-type id="openWindowRemainingTime">
<item-type>Number:Time</item-type>
<label>Override Remaining Time</label>
<description>The remaining Open Window heating/cooling Override time in the Zone</description>
<category>Window</category>
<state readOnly="true" pattern="%.0f %unit%"/>
</channel-type>
</thing:thing-descriptions>

View File

@ -14,6 +14,13 @@
<description>Current humidity in %</description>
</update-channel>
</instruction-set>
<instruction-set targetVersion="2">
<add-channel id="openWindowRemainingTime">
<type>tado:openWindowRemainingTime</type>
</add-channel>
</instruction-set>
</thing-type>
</update:update-descriptions>