Hi, I have this rule that works one time, and then stops working with the error below.
Anyone have a clue what I’m doing wrong?
var Timer_genny_auto
rule "Generator"
when
Time cron "0 0/1 * * * ?" // every hour
//Item Voltage received update
//Item VoltageTime changed
then
if (Generator.state == "ON"){
// sendCommand(generator_on, ON)
logInfo("voltage.rules", "Generator turned on automatically" )
if(Timer_genny_auto!==null) {
Timer_genny_auto.cancel
Timer_genny_auto = null
}
Timer_genny_auto = createTimer(now.plusSeconds(30)) [|{
// sendCommand(generator_off, ON)
logInfo("voltage.rules", "Generator turned off automatically" )
}]
}else{
logInfo("voltage.rules", "Nothing works" )
}
end
The error
2021-02-02 07:28:00.001 [INFO ] [smarthome.model.script.voltage.rules] - Generator turned on automatically 2021-02-02 07:28:30.003 [INFO ] [smarthome.model.script.voltage.rules] - Generator turned off automatically 2021-02-02 07:29:00.001 [INFO ] [smarthome.model.script.voltage.rules] - Generator turned on automatically 2021-02-02 07:29:00.002 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Generator': 'cancel' is not a member of 'null'; line 12, column 26, length 23 2021-02-02 07:30:00.001 [INFO ] [smarthome.model.script.voltage.rules] - Generator turned on automatically 2021-02-02 07:30:00.002 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Generator': 'cancel' is not a member of 'null'; line 12, column 26, length 23