Mit einem Bewegungsmelder ging das so
Code: Alles auswählen
var Timer Alexa_Timer = null
val Integer Alexa_TimeOut = 70
rule "Alexa Garage" //schalten Alexa Garage
when
Item AqaraBew changed from OFF to ON
then
if (Alexa_Timer !== null) {
Echo_Garage_Radio.sendCommand(ON)
logInfo("Alexa","Einschalten " + Alexa_TimeOut + " Seconds")
Alexa_Timer.reschedule(now.plusSeconds(Alexa_TimeOut))
} else {
logInfo("Alexa", "Alexa Bewegung erkannt! Schalte Sie Alexa ein")
Echo_Garage_Radio.sendCommand(ON)
logInfo("Alexa","Einschalten " + Alexa_TimeOut + " Seconds")
Alexa_Timer= createTimer(now.plusSeconds(Alexa_TimeOut))
[|
if (AqaraBew.state == ON)
{
logInfo("Alexa","Einschalten Timer ausgelöst, aber erneut für angefangen " + Alexa_TimeOut + " Seconds")
Alexa_Timer.reschedule(now.plusSeconds(Alexa_TimeOut))
} else {
logInfo("Alexa", "Alexa Keine Bewegung erkannt! ausschalten")
Echo_Garage_Radio.sendCommand(OFF)
Alexa_Timer = null
}
]
}
so?
Code: Alles auswählen
rule "Alexa Garage" //schalten Alexa Garage 2 Bewegungsmelder
when
Item AqaraBew changed from OFF to ON or
Item AqaraBew1 changed from OFF to ON
then
if (Alexa_Timer !== null) {
Echo_Garage_Radio.sendCommand(ON)
logInfo("Alexa","Einschalten " + Alexa_TimeOut + " Seconds")
Alexa_Timer.reschedule(now.plusSeconds(Alexa_TimeOut))
} else {
logInfo("Alexa", "Alexa Bewegung erkannt! Schalte Sie Alexa ein")
Echo_Garage_Radio.sendCommand(ON)
logInfo("Alexa","Einschalten " + Alexa_TimeOut + " Seconds")
Alexa_Timer= createTimer(now.plusSeconds(Alexa_TimeOut))
[|
if (AqaraBew.state == ON)
if (AqaraBew1.state == ON)
{
logInfo("Alexa","Einschalten Timer ausgelöst, aber erneut für angefangen " + Alexa_TimeOut + " Seconds")
Alexa_Timer.reschedule(now.plusSeconds(Alexa_TimeOut))
} else {
logInfo("Alexa", "Alexa Keine Bewegung erkannt! ausschalten")
Echo_Garage_Radio.sendCommand(OFF)
Alexa_Timer = null
}
]
}
Code: Alles auswählen
if (AqaraBew.state == ON)
if (AqaraBew1.state == ON)
wie mache ich das mit oder?
Oder gibt es noch besere Lösung?