Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bundles/org.openhab.binding.tado/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public enum OperationMode {
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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -262,6 +263,18 @@ public State getOpenWindowDetected() {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ private void updateZoneState(boolean forceUpdate) {

updateState(TadoBindingConstants.CHANNEL_ZONE_OPEN_WINDOW_DETECTED, state.getOpenWindowDetected());

updateState(TadoBindingConstants.CHANNEL_ZONE_OPEN_WINDOW_REMAINING_TIME,
state.getOpenWindowRemainingTime());

updateDynamicStateDescriptions(zoneState);

onSuccessfulOperation();
Expand Down Expand Up @@ -514,6 +517,8 @@ private void updateDynamicChannels(CapabilitiesSupport capabilitiesSupport) {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>

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