Switch with expire

Hello

Try switch with expire rule and its work OK
In my UI I want to send 3 or more different option for expire
After reading expire binding doc I understand that this is not support so I try to add string item and use it for help like this:
Item
String LightSwitchExpiration
Switch LightSwitch “Light” {expire=“LightSwitchExpiration,command=OFF”}

Rule
rule “Test Timer”
when
Item LightSwitchExpiration changed
then
LightSwitch.sendCommand (ON)
end

the switch never turn off
019-03-20 18:12:21.473 [ome.event.ItemCommandEvent] - Item ‘LightSwitchExpiration’ received command 30s

2019-03-20 18:12:21.493 [vent.ItemStateChangedEvent] - LightSwitchExpiration changed from 10s to 30s

2019-03-20 18:12:21.511 [ome.event.ItemCommandEvent] - Item ‘LightSwitch’ received command ON

What is the problem?

Oded

Please use code fences, it makes reading your topic much easier for those who are willing to provide you with help. Note that in Firefox the buttons may not show up but if you hover over them then the fly over help will popup.

Item

String LightSwitchExpiration
Switch LightSwitch “Light” {expire=“LightSwitchExpiration,command=OFF”}

Rule

rule “Test Timer”
when
    Item LightSwitchExpiration changed
then
    LightSwitch.sendCommand (ON)
end

the switch never turn off

019-03-20 18:12:21.473 [ome.event.ItemCommandEvent] - Item ‘LightSwitchExpiration’ received command 30s

2019-03-20 18:12:21.493 [vent.ItemStateChangedEvent] - LightSwitchExpiration changed from 10s to 30s

2019-03-20 18:12:21.511 [ome.event.ItemCommandEvent] - Item ‘LightSwitch’ received command ON

There actually is no problem. This simply does not work:

Switch LightSwitch “Light” {expire=“LightSwitchExpiration,command=OFF”}

The documentation also states the format the must be used:

In your case the Expire binding reads ‘LightSwitchExpiration’ as a literal text string. It will not lookup the value of the LightSwitchExpiration item. The text ‘LightSwitchExpiration’ does not qualify as a correct time and hence the expire binding does not know when it should expire the state.

Hi Marcel

according to John Cocula here:
https://community.openhab.org/t/please-test-the-new-expire-binding/17550/96
It should work
The only problem is that there is no default value for the String but it also have solution

Oded

I think you need to carefully read that posting again :slight_smile: They are simply discussing they idea of how this could work.