Rule with timer runs just once a time after reboot

Platform information:

*Hardware: RaspberryPi 3 Model B
*OS: OpenHab2
*Java Runtime Environment: Zulu Embedded, build 1.8.0_152-b76
*openHAB version:2.2


the following rule runs just once a time after reboot.

What could be the issue? I compared it to several rule examples here in the forum, but couldn´t find a hint.

var Timer timerBadFenster = null

rule "BadFenster offen"


        Item BD_K_Fenster_State changed from CLOSED to OPEN

        if(timerBadFenster === null || timerBadFenster.hasTerminated) {
        logInfo("BadFenster","Bad Fenster wurde geoeffnet")

        timerBadFenster = createTimer(now.plusMinutes(30), [|
                logInfo("BadFenster","Nachricht senden")
            timerBadFenster = null
            sendTelegram("homesweethome", "Badfenster offen!")

rule "Reset BadFenster Status"

        Item BD_K_Fenster_State changed to CLOSED


        if(timerBadFenster !== null) timerBadFenster.cancel()
        logInfo("BadFenster","Badfenster wurde geschlossen und Timer resetet")


Think of createTimer as a setTimeout in Javascript. It isn’t like a setInterval. If you want to repeat, call timer.reschedule at the end

Thanks for your reply, that´s not the problem. But this a good thing, so I could enhance my rule. :slight_smile:

The problem is, that after a reboot the rule works as expected, but the next times nothing happens. It runs just once until the next reboot or reload of the rule.

I guess there is an issue with the variable.