Hi guys!
I’e been reading a lot on this forum to get my system up and running the way I like it and I’m nog digging into rules. I’ve been able to write a couple of simple rules using the design patterns found on this page and they work fine.
I’m now trying to change the state of our Tado heating system whenever a window opens, whowever I get stuck using the correct syntax to advance. I’ve been able to change the Tado from Schedule to Timer by setting the setpoint temperature to 5 degrees whenever a window opens but that’s not what I try to achieve. I would like to switch the operation mode to MANUAL whenever a window is opened and set it back to SCHEDULE when it closes.
ITEMS:
//Tado Thermostat Living Room
Number:Temperature HEAT_inside_temperature "Living Room Temperature" (Livingroom, Temperatures) { channel="tado:zone:8671c7f6:1:currentTemperature" }
Number HEAT_humidity "Living Room Humidity" (Livingroom, Temperatures) { channel="tado:zone:8671c7f6:1:humidity" }
Number HEAT_heating_power "Heating Power" (Livingroom) { channel="tado:zone:8671c7f6:1:heatingPower" }
String HEAT_hvac_mode "HVAC Mode" (Livingroom) { channel="tado:zone:8671c7f6:1:hvacMode" }
Number:Temperature HEAT_target_temperature "Target Temperature" (Livingroom, Temperatures) { channel="tado:zone:8671c7f6:1:targetTemperature" }
DateTime HEAT_overlay_expiry "Setting Expiry" (Livingroom) { channel="tado:zone:8671c7f6:1:overlayExpiry" }
Number HEAT_timer_duration "Timer Duration" (Livingroom) { channel="tado:zone:8671c7f6:1:timerDuration" }
String HEAT_operation_mode "Operation Mode" (Livingroom) { channel="tado:zone:8671c7f6:1:operationMode" }
SITEMAP:
Text label="Heating Controls" icon="settings" {
Text item=HEAT_inside_temperature icon="temperature"
Text item=HEAT_humidity icon="humidity"
Text item=HEAT_heating_power
Setpoint item=HEAT_target_temperature minValue=5 maxValue=25
Selection item=HEAT_hvac_mode mappings=[OFF=off, HEAT=on]
Selection item=HEAT_operation_mode mappings=[SCHEDULE=schedule, MANUAL=manual, UNTIL_CHANGE="until change", TIMER=timer]
Setpoint item=HEAT_timer_duration minValue=5 maxValue=60 step=1
Text item=HEAT_overlay_expiry icon="none"
}
RULES:
rule "Turn off heating when window is opened"
when
Item LeftStudioWindow_OpenStatus changed
then
if (LeftStudioWindow_OpenStatus.state == OPEN) {
HEAT_target_temperature.sendCommand(5)
}
end
rule "Turn off heating when window is closed"
when
Item LeftStudioWindow_OpenStatus changed
then
if (LeftStudioWindow_OpenStatus.state == CLOSED) {
HEAT_operation_mode ???
}
end
LOG:
thome.event.ItemStateChangedEvent] - HEAT_target_temperature changed from 5.0 °C to 21.0 °C
08:48:03.639 [INFO ] [smarthome.event.ItemStateChangedEvent] - LeftStudioWindow_OpenStatus changed from CLOSED to OPEN
08:48:03.673 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'HEAT_target_temperature' received command 5
08:48:03.675 [INFO ] [arthome.event.ItemStatePredictedEvent] - HEAT_target_temperature predicted to become 5
08:48:03.681 [INFO ] [smarthome.event.ItemStateChangedEvent] - HEAT_target_temperature changed from 21.0 °C to 5.0 °C
As you can see if I use the HEAT_target_temperature.sendCommand(5) I’m able to set the temperature but instead I would like to use the mappings of the HEAT_operation_mode instead found in the sitemap. Can somebody help on this?
Thanks!