OH3 Item Expiration Timer gets fired athough nothing changed

Hello

I have configured a RollerShutter item using the new OH3 GUI to control my RollerShutters using the LCN binding.
Not to let the relays unnecessarily under power I want to send a STOP command after a given time after the UP or DOWN command was received by the item.

So I found the expiration timer MetaData of items which looked like it is exactly what I was searching for.
So I configured a timer which send the STOP command after 15 seconds after a command/state change occurs.

The timer is fired correctly after a command/state change occured,.
The problem is, that the timer now gets fired every 15 seconds although nothing changes (so new command was received, no state changed).

Does anyone have a clue what I am doing wrong or what my problem is ?

Kind regards
Christian

Expire works on updates, not changes.

See -

Ok, but there is no update to that item the Expiration Timer is specified for as you can see in the excerpt of the events.log.
There is nothing that sends any command to that item or that updates the item.

This is one of those cases where understanding the difference between a state and a command is important. Expire works on state, not commands. The config looks something like:

expire="15s,command=STOP"

Whenever the Item is updated to a state that is not the same as the state defined in the Expire config, in this case STOP, whether or not the Item’s state is changed in response to that update, Expire will create/reschedule a timer to, in your case send a command STOP.

This is where the problem comes in. Expire is watching for the Item to become the state STOP. Any other state will cause Expire to reset the Timer. But STOP is a command, not a state. The Item will never become the state STOP because STOP is not a valid state.

So what’s happening is after 15 seconds, the STOP command is issued. The binding receives that command and updates the Rollershutter’s state to what ever it happens to be (some number between 0 and 100 I believe). That number isn’t STOP so Expire reschedules the timer and issues the STOP command again. Repeat forever.

The tl;dr here is you’ll have to implement this in a Rule, not using Expire.

1 Like

@rlkoshak thanks for the clarification.
You’re right the state of the RollerShutter is a value between 0 (open) and 100 (closed) but the commands that must be sent are UP, DOWN and STOP.

From the documentation ( Items | openHAB) I got another understanding.
I read the sentence :

The expiration timer is started or restarted every time an item receives an update or a command other than the specified “expire” update/command.

as if the last received command will also be monitored not just the state.
But it looks like that is not the case and I will have to write some rules :wink:

Thanks again for the hint.

Updates to same state do not show up in events.log.
The thread I pointed you at includes a simple way to check, if you wanted to eliminate that.

edit - I just made a quick test in OH2, a Rollershutter Item unlinked to any device and expire=“10s,command=STOP”.
Sent it a command “50”, and as expected it autoupdates to state 50. Then get command STOP after 10secs.
Importantly, this NOT followed by a loop of
(state not stop) - time - STOP - (state not stop) - time - STOP
which I reckon is correct.

As the “expire” feature has been completely re-engineered in OH3, it is entirely possible this edge case got overlooked, and that would be a regrssion bug. So it would be helpful if someone could repeat this little test in OH3.
MORE EDIT - okay it sounds like this is working as expected in OH3 as well.

1 Like

Thanks, @rossko57 thats good to know.

I just checked and every 15 seconds the item gets updated to same state as you supposed.

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