Hi to all.
I have a timer rule, which is activated trough a akku switch “ON” and runs for 180 minutes. It can be stopped if the akku switch will be set to OFF. Or it runs another 180 minutes period if the Akku switch is still ON.
var Timer testTimer = null
rule "Timmer Homematic Akkus"
when
Item Virtuell_Akku1 changed to ON
then
if (testTimer == null)
{
logInfo("testTimer", "Schedule timer")
testTimer = createTimer(now.plusMinutes(180))
[|say("Bitte Batterien im Fensterkontakt Gäste WC tauschen!")
if (Virtuell_Akku1.state == ON)
{
logInfo("testTimer", "Reschedule timer - TestSwitch is still ON")
testTimer.reschedule(now.plusMinutes(180))
}
]
}
else
{
// this should not be possible, Sample Rule2 should prevent this
logInfo("testTimer", "Reschedule timer")
testTimer.reschedule(now.plusMinutes(180))
}
end
rule "Sample Rule2"
when
Item Virtuell_Akku1 changed from ON to OFF
then
if(testTimer != null)
{
logInfo("testTimer", "Cancel timer")
testTimer.cancel
testTimer = null
}
end
It works, but the Info in logview is:
2018-05-02 22:44:55.060 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'Akkutimer10.rules', using it anyway:
The operator '==' should be replaced by '===' when null is one of the arguments.
The operator '!=' should be replaced by '!==' when null is one of the arguments.
If i replace this operators, the rule doesn't work.
Can anyone help?
Thanks,
Markus