I am fairly new to OpenHab, have managed to get my devices in as items and to show in the sitemap. Now I am trying a few rules. The rule in question is supposed to shut off a switch that controls some outdoor lights after 10 seconds (it will be longer once it works). The rule works if I click the light on through the web or when the light kicks on through another rule, the rule does not work when the physical switch pressed.
Do I need to use a different trigger event than ‘changed’?
Item
Switch sw_side_lamp “Side Lamp” {zwave=“14:0:command=switch_binary”}
Rule
var Timer timer = null rule "Side Light Timer" when Item sw_side_lamp changed then if(sw_side_lamp.state == ON) { if(timer==null) { // first ON command, so create a timer to turn the light off again timer = createTimer(now.plusSeconds(10)) [| sendCommand(sw_side_lamp, OFF) ] } else { // subsequent ON command, so reschedule the existing timer timer.reschedule(now.plusSeconds(10)) } } else if(sw_side_lamp.state == OFF) { // remove any previously scheduled timer if(timer!=null) { timer.cancel timer = null } } end