OH3 Item expire

Hi there,
I wanted to ask how to use the Expire function in the item configuration. Does that work with OpenHAB 3 like with 2.5 with the Expire binding?
e.g.
Switch SensorHeartbeat {expire = "10m, command = OFF"}

Unfortunately I couldn’t find anything about it in the item documentation.

thanks

It is there.

Parameter expire

This parameter allows to post an update or command to an item after a period of time has passed.

Thank you, I was looking on the wrong page: Items | openHAB
:slight_smile:

1 Like

Hi,
is there a method to ask an expiring item for the remaining time in rules in OH3?

Nope. You cannot change the expire time, ask for the expire time,or cancel the expire time. It’s just basic, by design.
Anything more sophisticated must be done using timers in rules.

Having said that, you could use expire and work out for yourself when it’s due to end.
A rule can listen for the events that start or reschedule expire, and each could update a ‘due to end’ timestamp, so long as the rule knows the expire period.
When you want to know “how much longer”, calculate from now to due time.

1 Like

@rossko57 Thanks for your idea. Calculating it would sure be an option. But what I wanted to avoid is to define the expiration time twice (in item configuration and in the rule).

What happens to an item that has an active expire running and system restarts? I assume the item gets its value reset based on persistence. Does it start a new expire timer as well?

Nope.

It would be more appropriate for the expire timer to auto restart on a “System started”.

A fairly significant breaking change for other people with different uses. But that doesn’t stop you putting in a suggestion on Github - expire is part of Core in OH3