Im trying to do this simpe job by one rule and one item file.
basic.items as follows
Switch Smart6 "Smart6 WallPlug" <switch> {zwave="29:command=switch_binary" }
29 is the z-wave network node Id i hope
basic.rules as follows…
var Timer timer = null
rule "Timer Demo"
when
Item Smart6 received command
then
if(receivedCommand==ON) {
if(timer==null) {
// first ON command, so create a timer to turn the light off again
timer = createTimer(now.plusSeconds(2)) [|
sendCommand(Smart6, OFF)
]
} else {
// subsequent ON command, so reschedule the existing timer
timer.reschedule(now.plusSeconds(2))
}
} else if(receivedCommand==OFF) {
// remove any previously scheduled timer
if(timer!=null) {
timer.cancel
timer = null
}
}
end
I struggle with that simple thing now for hours but i cant get it work.
Any ideas whats wrong?