I’ve been attempting to use Rich’s excellent timer example to blink a light every 1-3 seconds. Problem is I’m running into an error. mismatched “)” error?
- I’ve noticed that using VSC I sometimes need to retype in lines because “rules” don’t see the code the the way I see them? I think there is hidden text creeping in from cut and paste but not sure? I only mention this because I just thought that could be my problem and I need to go try re-entering everything.
- If it is not then I don’t see where I’m missing “)” as indicated with this simple code.
rule “Weather Room lights”
when
Time cron "0/30 * * ? * *"
then
// Create a timer to blink the light for 30 seconds
timer = createTimer(now, [ |
CliffOfc_Wall_Light.sendCommand(if(CliffOfc_Wall_Light.state == 100) 0 else 100)
if(now.isBefore(timeStarted.plusSeconds(30) timer.reschedule(now.plusSeconds(2))
else timer = null
])
end
It can’t get much simpler than this yet I get this error?
2020-03-21 19:50:26.455 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘myrules.rules’ has errors, therefore ignoring it: [15,53]: mismatched input ‘timer’ expecting ‘)’
There is nothing more to the rule or in the .rules file than this? Anyone got an idea?