rule "Right rollershutter DOWN"
when
Item Shutter_GF_Living_Right received command DOWN
then
timer = createTimer(now.plusSeconds(24),
[| timer = null publish("localbroker", "ourhome/livingroom/right", "down")
])
end
Is it possible to create a rule, so when the item receives command STOP, to cancel the above timer and publish(“localbroker”, “ourhome/livingroom/right”, “down”)?
I have the same rule for my left shutters.
Thank you in advance.
rule "Cancel Timer"
when
Item Shutter_GF_Living_Right received command STOP
then
if (timer !== null) {
timer.cancel
timer = null
publish("localbroker", "ourhome/livingroom/right", "down")
// or did you mean: publish("localbroker", "ourhome/livingroom/right", "stop")
} else {
// Timer not running
}
end
Note there may be syntax errors as I haven’t actually run this rule.