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.