Hi,
I have the following code in a rule:
var Timer blindsBlockedTimer = null
rule "Disable blinds blocking after some time"
when
Item Blinds_Blocked received update ON
then
if(blindsBlockedTimer == null) {
blindsBlockedTimer = createTimer(now.plusSeconds(150)) [|
Blinds_Blocked.postUpdate(OFF)
logInfo("blinds rules", "Auto blocking blinds disabled by timer")
blindsBlockedTimer = null
]
logInfo("blinds rules", "Blinds_Blocked received update ON, starting timer to disable")
} else {
blindsBlockedTimer.reschedule(now.plusSeconds(155))
logInfo("blinds rules", "Blinds_Blocked received update ON, rescheduling timer to disable")
}
end
Blinds_Blocked is triggered several times a day, mostly with 5-30s between individual triggers and than very long pauses (several hours).
Most of the time the code works as expected, but sometimes Blinds_Blocked will not be set to off, even 30min after the last update. It seems to work OK, when using an anonymous timer, but in this case I can not re-trigger it and the code would start several timers when Blinds_Blocked is updated while a timer is still active.
I suspect, that there is a problem with the timer, has anybody else seen such problem?
Juelicher