I upgrade my OH2.2 to 2.3.
All works fine, but the timer in my rules not working after upgrade.
Here my timer rule:
import org.openhab.model.script.actions.Timer
var Timer timer
rule "If NH_TV_WZ more then 2 min not available, send OFF to WZ_Power_TV"
when
Item NH_TV_WZ changed
then
if(NH_TV_WZ.state==OFF) {
timer = createTimer(now.plusSeconds(120)) [|
sendCommand(WZ_Power_TV, OFF)
]
} else {
if(timer!==null) {
timer.cancel
timer = null
}
}
end
There is no error in log.
Know any one why the timer not work under 2.3?
You need to add a space after the [ of the timer lambda.
var Timer timer
rule "If NH_TV_WZ more then 2 min not available, send OFF to WZ_Power_TV"
when
Item NH_TV_WZ changed
then
if(NH_TV_WZ.state==OFF) {
timer = createTimer(now.plusSeconds(120)) [ |
sendCommand(WZ_Power_TV, OFF)
]
} else {
if(timer!==null) {
timer.cancel
timer = null
}
}
end