Hi folks,
I have a problem with my timer reschedule in a rule. The reschedule loop will not end properly. The rule should shut down my heater immediately, when the window is opend. If the outside temperature is lower than 12°C and the window is opend for more than 30min I want so send a push message.
Mi_DW_WC_Status = window contact switch
Heating_Day.state = for setting my heaters to day or night temperature
val String logfilename = "heating.rules"
val Number TempMid = 19.0
val Number TempOff = 4.5
var CurrentHour = now.getHour
var Timer Timer_WC = null
rule "WC Fenster"
when
Item Mi_DW_WC_Status changed
then
if (Heating_Mode.state == "NORMAL" && Mi_DW_WC_Status.state == OPEN && Heating_Day.state == ON && Mi_Aqara_THP_Aussen_Temperature.state <= 12.0 | "°C") {
ZWave_Popp_WC_Setpoint.sendCommand(TempOff)
logInfo(logfilename, "Heating NORMAL: Fenster AUF, WC AUS")
Timer_WC = createTimer(now.plusMinutes(30)) [|
sendNotification("xxx@xxx.net", "WC Fenster offen")
if (Virtual_Window_WC.state == OFF) {
Virtual_Window_WC.sendCommand(ON)
}
Timer_WC.reschedule(now.plusMinutes(30))
]
}
else if (Heating_Mode.state == "NORMAL" && Mi_DW_WC_Status.state == CLOSED && Heating_Day.state == ON && Timer_WC !== null) {
Timer_WC?.cancel
ZWave_Popp_WC_Setpoint.sendCommand(TempMid)
if (Virtual_Window_WC.state == ON) {
Virtual_Window_WC.sendCommand(OFF)
sendNotification("xxx@xxx.net", "WC Fenster geschlossen")
}
logInfo(logfilename, "Heating NORMAL: Fenster ZU, WC 19°C")
}
else if (Heating_Mode.state == "NORMAL" && Mi_DW_WC_Status.state == CLOSED && Heating_Day.state == OFF && Timer_WC !== null) {
Timer_WC?.cancel
ZWave_Popp_WC_Setpoint.sendCommand(TempOff)
if (Virtual_Window_WC.state == ON) {
Virtual_Window_WC.sendCommand(OFF)
sendNotification("xxx@xxx.net", "WC Fenster geschlossen")
}
logInfo(logfilename, "Heating NORMAL: Fenster ZU, WC 4,5°C")
}
end