Expire Binding doesn't seem to work

I’ve set up a switch with an expire Bindung. I want it to turn off after a certain time. For testing I wanted it to turn off after 3 minutes.

This is my set up:

Switch bewaesserungSwitch1 "bewaesserungSwitch1" { channel="http:url:bewaesserungSwitch1:setSwitch", alexa="PowerController.powerState", expire="3m,command=OFF" }

However, the switch is never turned off. I cannot see any problems in the log files. Does anyone know what I did wrong?

I am on version 3.3.0

The thing is, when your item is updated through the channel the timer will reset. Even when item state does not change.
There are “workarounds” with dummy items. See here:

1 Like

There is also an option to ignore state updates.

1 Like

How can I activate this setting in the config files?

I see the option “ignore state updates” in the UI, however when I click this it won’t stick.

If you ever need to see what the names of the parameters are, set it up in the UI and open the “Code” tab.

In this case it’s Item metadata so it takes the form of <namespace>=<value>[<config1>:<value>, <config2>:<value>]. In the code tab that will look like

value: <value>
config:
  config1: <value>
  config2: <value>

So once you configure it in the UI:

Look at the code:

value: 0h3m0s,command=OFF
config:
  ignoreStateUpdates: "true"

and translate that to .items file syntax

expire="0h3m0s,command=OFF"["ignoreStateUpdates": "true"]

I can’t remember off the top of my head if the quotes are required around the ignoreStateUpdates part or not.

2 Likes

For me the following worked now:

Switch bewaesserungSwitch1 "bewaesserungSwitch1" { channel="http:url:bewaesserungSwitch1:setSwitch", alexa="PowerController.powerState", expire="4h,command=OFF" [ignoreStateUpdates= "true"] }

Just wondering: Why is the state “updated” through the channel when nothing changes? I don’t think I quite understand “state updates” yet.

The switch is controlled by an http-Binding. When I turn it on / off on the device or by Alexa, it still changes it value. So what am I now “ignoring”?

Depends on the implementation of the binding. Some devices report their current state periodically whether or not they’ve changed. In those cases, the binding will usually update the Item to indicate that the device reported a new state that happens to be the same as the old state.

There are three distinct events an Item can experience:

  • Update: a new state was sent to the Item
  • Changed: an update that resulted in a change in the state of the Item
  • Commands: an Item was told to do something. A command may or may not result in an update. A command may or may not be the same as an Item’s state (e.g. sending ON to a Dimmer Item could result in that Item changing state to 100).

In the expire config, by setting ignoreStateUpdates to true, you are making it so expire does not reset except for commands or changes and not updates. There is a corresponding ignoreCommands option to have it ignore commands too.

2 Likes