I monitore my windows status and send a message to alexa when a window is opened for longer than 15 minutes.
My rule looks like this:
rule "Window open while heat is on"
when
Item gEGContacts changed to OPEN or
Item gOGContacts changed to OPEN or
Item gDBContacts changed to OPEN
then
if(EG_Vi_hkpump.state == ON){
if(stopMotionTimer === null && gEGContacts.state == OPEN && gOGContacts.state == OPEN && gDBContacts.state == OPEN){
stopMotionTimer = createTimer(now.plusMinutes(15)) [|
Echo_TTS.sendCommand('Die Heizung ist an. Bitte Fenster schließen im Erd, Ober und Dachgeschoss.')
stopMotionTimer = null
]
}
else if(stopMotionTimer === null && gEGContacts.state == CLOSED && gOGContacts.state == OPEN && gDBContacts.state == OPEN){
stopMotionTimer = createTimer(now.plusMinutes(15)) [|
Echo_TTS.sendCommand('Die Heizung ist an. Bitte Fenster schließen im Ober und Dachgeschoss.')
stopMotionTimer = null
]
}
else if(stopMotionTimer === null && gEGContacts.state == OPEN && gOGContacts.state == CLOSED && gDBContacts.state == OPEN){
stopMotionTimer = createTimer(now.plusMinutes(15)) [|
Echo_TTS.sendCommand('Die Heizung ist an. Bitte Fenster schließen im Erd und Dachgeschoss.')
stopMotionTimer = null
]
}
else if(stopMotionTimer === null && gEGContacts.state == OPEN && gOGContacts.state == OPEN && gDBContacts.state == CLOSED){
stopMotionTimer = createTimer(now.plusMinutes(15)) [|
Echo_TTS.sendCommand('Die Heizung ist an. Bitte Fenster schließen im Erd und Obergeschoss.')
stopMotionTimer = null
]
}
else if(stopMotionTimer === null && gEGContacts.state == OPEN && gOGContacts.state == CLOSED && gDBContacts.state == CLOSED){
stopMotionTimer = createTimer(now.plusMinutes(15)) [|
Echo_TTS.sendCommand('Die Heizung ist an. Bitte Fenster schließen im Erdgeschoss.')
stopMotionTimer = null
]
}
else if(stopMotionTimer === null && gEGContacts.state == CLOSED && gOGContacts.state == OPEN && gDBContacts.state == CLOSED){
stopMotionTimer = createTimer(now.plusMinutes(15)) [|
Echo_TTS.sendCommand('Die Heizung ist an. Bitte Fenster schließen im Obergeschoss.')
stopMotionTimer = null
]
}
else if(stopMotionTimer === null && gEGContacts.state == CLOSED && gOGContacts.state == CLOSED && gDBContacts.state == OPEN){
stopMotionTimer = createTimer(now.plusMinutes(15)) [|
Echo_TTS.sendCommand('Die Heizung ist an. Bitte Fenster schließen im Dachgeschoss.')
stopMotionTimer = null
]
}
}
But the problem is, that when a window is closed while the timer is running, alexa still brings the message that a window is open after 15 minutes. So I need a second check, if a window is still open after 15 minutes and I don’t know how to do it.
An other problem is, that I would like to put alexas volume to a certain value before the window message is played. After the message I would like to restore the previous volume.
And Ideas?
By the way - I am a noob learning