Rules using Timer-Object stopped working

  • Platform information:
    • raspberry4 + openhabian
  • Issue of the topic: All my rules using the Timer-Object dont work anymore
    The timer just stays at null.
    The rule itself worked nicely for years.

Any Ideas? Thx in advance &


var Timer timer=null
rule "Toilette Auto Licht"
        Item GT_Light_on_off_1 changed or
        Item GT_Light_Availability_1 changed
        if (GT_Light_on_off_1.state==ON && timer===null) {
                logInfo("toilette.rules", "Toilette: Anschalten erkannt, starte Timer")
                timer=createTimer(now.plusMinutes(4), [|
                        logInfo("toilette.rules", "Toilette: Timer abgelaufen - schalte aus")
                        if(timer!==null) {
        } else if (GT_Light_on_off_1.state==OFF&&timer!==null) {
                logInfo("toilette.rules", "Toilette: Resetting Timer: Licht wurde digital ausgeschaltet")
        } else if (GT_Light_Availability_1.state==OFF&&timer!==null) {
                logInfo("toilette.rules", "Toilette: Resetting Timer: Licht wurde manuell ausgeschaltet")
        } else if(GT_Light_Availability_1.state==OFF) {
                if (timer!==null) {
                    logInfo("toilette.rules", "Toilette: Licht ging grundlos Offline")

rule "Toilette Motion"

        Item GT_Motion_Sensor_Occupancy changed from "false" to "true"
        logInfo("toilette.rules","timer says "+timer)
        if(timer!==null) {
                logInfo("toilette.rules", "Toilette: Bewegung erkannt, Timer laeuft noch, mache nichts.")
        } else {
                logInfo("toilette.rules", "Toilette: Bewegung erkannt, schalte Licht an")

They wouldn’t just stop working unless something changed in your system. What version of OH are you running? Have you updated OH or Java?

If you haven’t done anything, then this might be a sign of SD card corruption. Install a previous backup on a fresh SD card to see if that works.

I am running openhabian on a rpbi4, using a usb-attached ssd since 2 years (os is booting and running from the usb-ssd - device is pretty well in shape).
I am regular running apt-get update & apt-get upgrade manually.
as stated, using openhabian.
The timer-object just stopped to work, it stays at “null”.

If you didn’t change anything, the only thing I can think of is that your variable is uppercase Timer and your rule refers to a lowercase timer. I don’t know why that would work and then suddenly not work, though.

Good ideas - I spent the weekend into it and was near madness, as I wasn’t able to detect any configuration-drift on my side (I am also using a private git-repo to persist my configurations).
Apparently someone “stole” my smart-light in the guest-toilet - I checked my zigbee2mqtt-server and the light itself was also there gone (many neighbours here).
Fortunately I have a hue remote around exactly for this case (pressing the I and O buttons near a zigbee-device for ~5secs will factory-reset it).
Due this, zigbee2mqtt was able to fetch this light again and openhab is now able again to run timer against it.

btw, “stealing” of zigbee-devices doesnt seem to be uncommon. My zigbee2mqtt-server has connected to at least seven zigbee-devices in the last 6months definately no in my ownership. If Hue- and Alexa-bridges are also this greedy, no wonder devices vanish before you could claim it :smiley:

So the conclusion is that your rule does not deal nicely with states NULL or UNDEF?

nah, much worse.
I have checked my logs, and apparently the item used for the toilet-light received an OTA-update.
this was like a factory reset.
afterwards it registered in the zigbee-network of someone else (either neighbour above or left).
the timer itself worked well, but on a thing / item not under control of openhab anymore.
zigbee2mqtt users have to be aware of this, but it was not a openhab-issue.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.