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).
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:
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.
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.