Expire binding and things: not working as espected

hello, newbie on using openHAB.
I defined a Hue lamp as an item in combination with expire binding. I made several switches with a different time to send “off” command.

When I manualy use the main switch on the sitemap to put the light on, all the time-switches go ON besides the main switch, and the light itself goes OFF after 30 seconds (the first expire defined item).

How do I define the item-switches in a correct way to distinguish the switches from each other?

I use an Intel NUC with Windows 10 and openHAB 2.5.0.M5 Milestone Build

This is my item:

// Hue White Light 03
Switch  Hue_WL_03_toggle		(All_White_Lights,All_Lights)  	{ channel="hue:0100:00178867432b:3:brightness" }
Dimmer  Hue_WL_03_brightness									{ channel="hue:0100:00178867432b:3:brightness" }
String  Hue_WL_03_alert   	    "Alarm[]"						{ channel="hue:0100:00178867432b:3:alert" }
Switch  Hue_WL_03_on_30s										{ channel="hue:0100:00178867432b:3:brightness", expire="30s,command=OFF" }
Switch  Hue_WL_03_on_60s										{ channel="hue:0100:00178867432b:3:brightness", expire="1m,command=OFF" }
Switch  Hue_WL_03_on_2m										{ channel="hue:0100:00178867432b:3:brightness", expire="2m,command=OFF" }
Switch  Hue_WL_03_on_5m										{ channel="hue:0100:00178867432b:3:brightness", expire="5m,command=OFF" }


Frame label="Hue White Lamp 03 (eetkamer)" {
        // Hue white Lamp 03
		Switch      item=Hue_WL_03_toggle			label="aan/uit"
		Switch      item=Hue_WL_03_on_30s			label="aan/uit (30s)" icon="light"
		Switch      item=Hue_WL_03_on_60s			label="aan/uit (60s)" icon="light"
		Switch      item=Hue_WL_03_on_2m			label="aan/uit (120s)" icon="light"
		Switch      item=Hue_WL_03_on_5m			label="aan/uit (5m)" icon="light"
        Slider      item=Hue_WL_03_brightness		label="sterkte"
        Switch      item=Hue_WL_03_alert        	label="alarm"	icon="alarm"	mappings=[NONE="None", SELECT="Alert", LSELECT="Long Alert"]
		Switch    	item=Hue_WL_03_brightness    	label="scene"   icon="light" 	mappings=[0="Off", 25="Low", 60="Normal", 100="High"]

Hi Thomas and welcome to the OpenHAB community!
What I’m not 100% clear on is if you are using Paper User Interface to create your Hue lamp ‘thing’
The first configuration file you posted says things: but it appears to be an items file

It is possible to create OpenHAB ‘things’ in a file, but for a new guy just getting started, letting Paper User Interface do it for you is much easier and less prone to problems. If the first configuration is actually a ‘items’ file (placed in the items folder) then you are good

Also if you are going to post files and rules (which is great because it will help us help you) place your stuff in code fences as it is much easier to read. Just place three tilde on a line (by themselves) before and after your code

rule "my rule"

it also helps to know your OpenHAB version and the platform it is running on

As mentioned by @Andrew_Rowe place things, items, rules, sitemap in code fence. Its the paper icon second from last in the list at the top.


Hue White Light 03
Switch Hue_WL_03_toggle (All_White_Lights,All_Lights) { channel=“hue:0100:00178867432b:3:brightness” }
Dimmer Hue_WL_03_brightness { channel=“hue:0100:00178867432b:3:brightness” }
String Hue_WL_03_alert “Alarm[]” { channel=“hue:0100:00178867432b:3:alert” }
Switch Hue_WL_03_on_30s { channel=“hue:0100:00178867432b:3:brightness”, expire=“30s,command=OFF” }
Switch Hue_WL_03_on_60s { channel=“hue:0100:00178867432b:3:brightness”, expire=“1m,command=OFF” }
Switch Hue_WL_03_on_2m { channel=“hue:0100:00178867432b:3:brightness”, expire=“2m,command=OFF” }
Switch Hue_WL_03_on_5m { channel=“hue:0100:00178867432b:3:brightness”, expire=“5m,command=OFF” }

Hello Andrew, thx for swift response. Not totally familiar with the vocublary yet, sorry for that. Off course I meant Items instead of things. I Adjusted the original post. Hope things (items :-)) are clear now.

yeah man… all that counts is did you get things sorted ok?

sure, adding things trough paper UI is pretty easy.Any idea on soving the question?

OK… I’m going to guess the light gets turned on and OpenHAB turns it back off reacting to the first item which is the shortest time period… guessing

I think your idea would work with just one switch but with 4, you may have to write a rule. What is the point of having 4? I get the idea is to have 4 different time periods but to what end?

Maybe there is a misunderstanding of what expire does. Any update or command to the Item (that does not match the expire instruction) begins or restarts the timing.

So, in the case of four “expiring” Items linked to the same channel … any update on the channel starts all four Items expire timers.

You could have no channels linked to the four Items. And a rule that listensd for a command to any one of them and passes it to the “real” Item/channel.

thx rossko, the explanation is quite clear.

Could you elaborate on the “no channels linked to the four items”? Is this obtained in the same rule? Could you give an example?

Sample Items

Group Expirings
Switch Real_Switch (All_White_Lights,All_Lights) { channel="real channel" }
Switch expire_30s (Expirings) { expire="30s,command=OFF" }
Switch expire_60s (Expirings) { expire="60s,command=OFF" }

Sample Rule

rule "pass the parcel"
   Member of Expirings received command

Usage - send an ON command to any of your available timers, from UI or rule.

You can add cleverness to determine if a timer is already running (by looking at timer Item states) and cancel if needed (by postUpdating to OFF)

[quote=“rossko57, post:8, topic:86156”]

I resume this post because I really cannot understand how to use the expire binding. All I want to do is having a button on my UI that trigger my TV to poweroff after 60min

These are my items

Switch        CA_TV_OnOff        "TV bedroom"     (CL)  ["Switchable"] { channel="samsungtv:tv:0bebc200_00c8_1000_9f61_50856903009e:power"}
Switch        CA_TV_AutoOff        "Turn off after 60min" <button>   (CL)  {expire="60m,command=OFF" }

This is my rule:

rule "TV bedroom autooff"
   Item CA_TV_AutoOff received command

But when I push the CA_TV_AutoOff button on the UI the rules is immediately triggered and my tv switch off.
How can I have a button that when pressed simply start the trigger that turnoff my tv after XX min ?

Yes. When you poke the UI it sends a command too …
You can see this in your events.log

You need to make your rule choosier about the commands it turns your TV off in response to.

   Item CA_TV_AutoOff received command OFF