Issue of the topic
Hi all, I’m trying to use simple timer rule for light management. I’ve read many post in community and now I’ve cretaed this simple rule:
// Timer per gestione accensione automatica luci
var Timer timerlgBoxPiccolo = null
var idLuceBoxPiccolo = "LuceBoxPiccolo"
rule "Luce Box Piccolo"
when
Item ctPIRBoxPiccolo changed from OPEN to CLOSED
then
logInfo(idLuceBoxPiccolo, "Start rule")
if(timerlgBoxPiccolo === null)
{
logInfo(idLuceBoxPiccolo, "Timer create")
sendCommand(lgBoxPiccolo, ON)
timerlgBoxPiccolo = createTimer(now.plusSeconds(120), [ |
sendCommand(lgBoxPiccolo, OFF)
timerlgBoxPiccolo = null
logInfo(idLuceBoxPiccolo, "Timer end")
])
logInfo(idLuceBoxPiccolo, "Timer created")
}
else
{
logInfo(idLuceBoxPiccolo, "Timer reschedule")
sendCommand(lgBoxPiccolo, ON)
timerlgBoxPiccolo.reschedule(now.plusSeconds(120))
}
logInfo(idLuceBoxPiccolo, "end rule")
end
It runs (with a significanty delay from PIR movement detection and light on) but I’m getting this error in log:
2020-03-16 00:55:50.484 [INFO ] [marthome.model.script.LuceBoxPiccolo] - Start rule
2020-03-16 00:55:50.491 [INFO ] [marthome.model.script.LuceBoxPiccolo] - Timer create
2020-03-16 00:55:50.552 [INFO ] [marthome.model.script.LuceBoxPiccolo] - Timer created
2020-03-16 00:55:50.561 [INFO ] [marthome.model.script.LuceBoxPiccolo] - end rule
2020-03-16 00:56:06.343 [INFO ] [marthome.model.script.LuceBoxPiccolo] - Start rule
2020-03-16 00:56:06.353 [INFO ] [marthome.model.script.LuceBoxPiccolo] - Timer reschedule
2020-03-16 00:56:06.361 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Luce Box Piccolo': 'reschedule' is not a member of 'org.eclipse.smarthome.model.script.internal.actions.TimerImpl'; line 436, column 3, length 50
2020-03-16 00:57:50.524 [INFO ] [marthome.model.script.LuceBoxPiccolo] - Timer end
I’ve done some tests and a lot of search in community but I’m not able to figure out what is the problem.
Thanks for any hints.
f
Dear rossko57 thank you very much, your hints has opened a new way in my mind.
I’ve removed the rule from the single file that i was using and I’ve created a new file limiting copy/paste and changing variables and rules names.
Then i’ve stopped OH, changed the rules files; at the end I’ve cleaned the OH cache deleting the directories (Clear the Cache).
After restarting (and waited the startup time) the rules are running ok.
Thanks again.
f