rule "rain stop"
when
Item Rain_indicator changed to OFF
then
if (Tellmewhenitsstop.state == ON){
sendNotification("rain stopped")
Tellmewhenitsstop.postUpdate(OFF)
}
else{
return;
}
end
so when its stop to rain and “Tellmewhenitsstop” is on. i receive notification. i what to change it to if Rain_indicator changed to OFF for 1 minute. only then send me notification
but i also need to add the Tellmewhenitsstop.state == ON. so it will be like this ?
rule "rain stop"
when
Item Rain_indicator changed to OFF
then
if (Tellmewhenitsstop.state == ON){
createTimer(now.plusMinutes(1), [ |
sendNotification("rain stopped")
])
}
end
and another question. does it send the alert in the end of the timer regardless of the Rain Indicator status? or only if its stay off for 1 min ?
thanks
i know. but i need this to send notification if the Rain_indicator stay off for 1 min. not 1 min after it changed to OFF
so if the “Rain_indicator” changed to OFF (and stay off for 1 min without changing to ON again) and “Tellmewhenitsstop” is ON, only then send the notification
rule "rain stop"
when
Item Rain_indicator changed to OFF
then
if (Tellmewhenitsstop.state == ON){
Rain_timer = createTimer(now.plusMinutes(1), [ |
sendNotification("rain stopped")
])
}
end
rule "rain stop 2"
when
Item Rain_indicator changed to ON
then
Rain_timer.cancel()
end
rule "rain stop"
when
Item Rain_indicator changed to OFF
then
if (Tellmewhenitsstop.state == ON){
createTimer(now.plusMinutes(1), [ |
if (Rain_indicator.state == OFF) { // It is still not raining after 1 minute
sendNotification("rain stopped")
}
])
}
end
// global var so rules can share it
var Timer Rain_timer = null
rule "rain stop"
when
Item Rain_indicator changed to OFF
then
if (Tellmewhenitsstop.state == ON){
Rain_timer = createTimer(now.plusMinutes(1), [ |
sendNotification("rain stopped")
Rain_timer = null // clear timer away
])
}
end
rule "rain start"
when
Item Rain_indicator changed to ON
then
if (Rain_timer != null) {
// timer is running
Rain_timer.cancel()
Rain_timer = null
}
end
The rain can stop and start as often as it likes; you will get a notification 1 minute after the last time it stops. Personally I’d make that a bit longer but I’m in the UK