Expire-bindings never expire

On openHABian and latest snapshot now, but I had the same issue on stable with openHAB2 installed on a Windows-computer as well.

I have tried getting the expire-binding to work in many different ways and it never fires.

Setup 1:

Switch bound to switch_dimmer (Fibaro dimmer 2 channel) with expire="1m,sendCommand(OFF)" 

Tested with expire from 2s to 30m and with "command=OFF", "OFF" et cetera too.

The switch turns on, but expires (the switch never changes to OFF)

Setup 2:

Switch 1 bound to switch_dimmer (Fibaro dimmer 2 channel).
Switch 2 a la "Switch My_Expire_Switch "MySwitch" [expire="2m,sendCommand(OFF)"}

When Switch 1 receives ON it successfully turns on Switch 2 with a “My_Expire_Switch.sendCommand(ON)”.

The expire-switch then never turns off.

I think this should be easy and should work, but obviously there is something I’m missing. The items do not get repeatedly updated (and hence postpone the expiration).

The things are added through GUI (habmin or paperUI).
Items are defined in items.items or similar.
Rules are defined in rules.rules or similar.

Example:

items.items:

Switch   My_Light_Switch             "Light"           <light>         (FF_Sov2)                {channel="zwave:device:99999999:nodeX:switch_dimmer", expire="1m,command=OFF"}

Rules.rules:

rule My_Light_Switch received ON"
when 
	Item My_Light_Switch received command ON
then
	logInfo("rules.rules","Lights received ON")
end

rule My_Light_Switch received OFF"
when 
	Item My_Light_Switch received command OFF
then
	logInfo("rules.rules","Lights received OFF")
end

Here “Lights received ON” will show in the log, but “Lights received OFF” will never show. And the item is not switched off either.

What am I missing?

This may be a silly question but you haven’t mentioned if the expire binding is installed

3 Likes

Not a silly question: I have not installed the expire binding (…).

I will try again this evening.

Thanks so much!

1 Like

That should solve the problem straight away

  • Install the binding
  • Restart openHAB to make sure the binding kicks in and the items are bound

You should be good to go

1 Like

Just to add that the expire binding is awesome and has so so so many uses…

I also think the EXPIRE binding is a great idea (esp. as opposed to standard timers) HOWEVER, I will state that I have a few EXPIRE virtual items which used to work (mostly startup delays to allow my zwave net to repopulate from a “cold start”) but they have been consistently NOT working since the OH 2.2 release.

for the record, I have two virtual items (for switches and dimmers respectively, defined as:

Switch  SW_Startup_Switch
Switch  SW_Startup_Dimmer

These are supposedly triggered by the following EXPIRE items:

Switch STARTUP_TIMER_5m_OFF { expire="15m,command=OFF" }
Switch STARTUP_TIMER_6m_OFF { expire="16m,command=OFF" }

I have changed the expire timeout from the nominal 5m/6m in the item names to 15m and 16m in the expire parameters because on a real “cold start” it can take a while for the (principally-zwave network) to initialize all the nodes.

The operative rules are:

rule "set SW_Startup_Flag OFF when startup timer expires"
    when
        Item STARTUP_TIMER_5m_OFF changed to OFF
    then
        ...
         ...

There are subsequent rules which trigger on the change of the SW_Startup_Switch viz.,

rule "u_01 SW_Startup_Switch changed to OFF"
    when
        Item SW_Startup_Switch changed to OFF
    then 
       //initialize a bunch of variables....
      
    ......

The symptom is that the STARTUP_TIMER items are NOT expiring…they USED TO prior to 2.2 release but now are not.

Adding the binding (again) makes the expire work again. Thanks again!

If I send an update through GUI or console to the item directly (for example to the aforementioned light-switch), the switch will turn off again after the expiration period.

I don’t get the items to react to me physically pushing the switch button though, but that’s not related to the expire binding. If I physically turn the light on, no events are recorded. Any help is much appreciated!

Have you verified that it is indeed the Item and not the Rule by looking in events.log and verifying that the Switch is not getting commanded to OFF and for some reason the Rule isn’t firing?

How do to command the Timer Items to ON? Perhaps that Rule is not running or running much later than you expect?

The fact that they are a startup timer there is a whole host of things that can be causing problems that are not related to Expire. It’s a pretty simple binding. I would expect it to either work all the time or work none of the time so when I see this I’m thinking the problem more likely lies outside the binding.

The fact that it used to work and now doesn’t with the upgrade also points to this being a timing problem and the fact that it worked before was a fluke of the timing. Gotta love multi-threaded debugging.

The reason for my physical things not updating through channels was that the association to the controller was not added during inclusion. Not sure how this happened as inclusion always has added the association group before and after.

So to conclude this thread from my side:
Symptom 1: Expire does not send command after the specified delay
Symptom 2: Physical buttons do not update items.

Solution to #1: Adding the Expire-binding.
Solution to #2: Adding association group in habmin (adding the zstick to Lifeline - Controller updates)

All.
I have a simimlar issue here with openHAB 2.2 on a Rasp PI 3 Model B

I just have to items switches here.
One is programing to switch off after 3 minutes and works reliable.
The other one is another switch that is programed to stay on for three hours but this is not switching off after its time.

I can’t send you the items definitions right now but they were copy and paste and replace the item name and the m from minutes to h for hours.
If no other has my simptoms I will add items definitions so probably anyone will see the mistake I can’t see.
Thanks.

Might the item get updated some time during those three hours so that the expire is postponed? This would be my first guess.

Thanks for the quick answer but no way. It’s the towel heater that I switch on after the shower and there isn’t any rule that can switch on again.

I would triple check the log anyway. Maybe it updates when waking up every other hour or something?

I’ll do when I arrive at home. Meanwhile do you know the binding name to filter the logs? Or I’m to lazy to check it in Karaf? :slight_smile:

cd /var/log/openhab2
cat openhab.log | grep YOURDEVICENAME

I think there was a change in OH 2.2. I see the same on ather topics too.

Item STARTUP_TIMER_5m_OFF changed to OFF

If the item changes from NULL to ON or OFF the rule is not triggered. I think this is by design to block rules form being fired on startup.

1 Like

Ok. I could check today the logs and just saw the manual switching On this morning (8:00) and the manual Off a couple of minutes ago.

I can’t see anything else that may update the item.

Meanwhile just in case I did something wrong this is my item

Switch ZToaBano “Toallero” (ElBano) [ “Switchable”] {channel=“zwave:device:xxxxxxxxxxx:node8:switch_binary”, expire=“3h, command=OFF”}

Thanks for your support, sometime in near future I may able to help others.

Regards

Sergi

Have you tried something like expire=“3m, command=OFF” just to check that the binding works?

Just change the item definition, then do a command=ON manually through GUI / bash and wait three minutes.

Thanks Andreas.

Yes I have another item with your configuration and works perfectly.

Now I’m using another item to act as bridge between the Zwave binding and the expire binging and seems to work.

Thanks

I just want to add that since recently I experience exactly the same problem with one of my 4 “expire-configured” switches. All worked fine few months ago.
Three of them are working as designed and switch off after 5, 10 and 15 Minutes respectively. The forth one which is set to 30 Minutes works… only sometimes - I didn’t get the pattern yet, although I suppose that switching it ON - let’s say electronically - works fine, but doing so manually (the wall switch) doesn’t.
What I don’t get is the fact that I can see manual ON in the log, and yet it won’t expire.

Solution to #2: Adding association group in habmin

@Landstad All four of them lacked the association to controller (yet three of them worked fine). I just added the association for all of them. I’ll see what happens…