In the log I have the following errors. Where he made a mistake in the role?
2016-12-30 13:48:44.975 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Swiatlo garaz2': cannot invoke method public abstract boolean org.openhab.model.script.actions.Timer.cancel() on null
Rules:
import org.openhab.model.script.actions.*
var Timer timer_garaz = null
rule "Swiatlo garaz2"
when
Item Swiatlo changed
then
if(timer_garaz==null && GarazLight.state==ON){
timer_garaz = createTimer(now.plusMinutes(5)) [|
sendCommand(buzzer, ON)
sendCommand(led1, ON)
Thread::sleep(500)
sendCommand(led1, OFF)
sendCommand(buzzer, OFF)
Thread::sleep(500)
sendCommand(GarazLight, OFF)
timer_garaz = null
]
}
else if(GarazLight.state==OFF)
{
timer_garaz.cancel
}
end