openhab / org.openhab.ui.habmin

HABmin - a graphical user interface for openHAB 2
231 stars 92 forks source link

Timer not executing 2nd time #261

Closed ashishgupt closed 7 years ago

ashishgupt commented 7 years ago

I am using openHAB2. I have created a rule to arm my security system 10 minutes after the system is ready between 10 pm and 6 am. It works fine when the event occurred for the first time but is not working on subsequent firing of the event. Here is my code:

var Timer timerStay = null
rule "Arm security"
    when
        Item alarmPanelStatusReady changed to 1
    then
        var Number hour = now.getHourOfDay  
        if ((hour >= 22)  || (hour <= 6)) {
            if(alarmPanelStatusReady.state as DecimalType == 1) {
              if(timerStay == null) {
                timerStay = createTimer(now.plusMinutes(10)) [|
                   sendCommand(armStay,ON)
                `]`
               }
            }
            else if(timerStay != null) {
              timerStay.cancel()
              timerStay = null
            }
        }
end
cdjackson commented 7 years ago

I don't think this is an issue with habmin - I would suggest to discuss on the OH2 forum, and if there's a bug raise it on the OH2 issue list or the ESH issue list.