Did syntax change in 2.3? I am seeing errors in rules that worked with 2.2.
Error:
2018-05-12 10:55:25.029 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'alarms.rules' has errors, therefore ignoring it: [12,40]: mismatched character '|' expecting ']'
[12,73]: mismatched input ']' expecting '}'
[12,81]: mismatched character '(' expecting ']'
[12,100]: mismatched input ')' expecting '}'
[13,7]: no viable alternative at input 'if'
[18,5]: mismatched input '}' expecting 'end'
Rule:
rule "Alarm Triggered"
when
Item Alarms received update
then
var boolean gotLock = lock.tryLock()
try {
if(gotLock) {
val alarm = Alarms.members.filter[s|s.lastUpdate("mapdb") !== null].sortBy[lastUpdate("mapdb")].last
if (alarm.state == OPEN) {
postUpdate(Notify_Service, "Alarm")
postUpdate(Notify_Message, alarm.label)
postUpdate(Notify_Person, "nathan")
}
}
}
catch(Exception e) {
logError("Alarms:", "Exception in rule 'Alarms': " + e.toString)
}
finally {
if(gotLock) {
lock.unlock()
}
}
end
Error:
2018-05-12 10:55:27.374 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'clock.rules' has errors, therefore ignoring it: [6,27]: mismatched character ' ' expecting ']'
[6,37]: no viable alternative at input 'clock'
[8,5]: extraneous input ']' expecting 'end'
Rule:
rule "Set Z-Wave Clocks"
when
Time cron "30 59 23 * * ?"
then
logInfo("Z-Wave","Setting Z-Wave Clocks")
Clock?.members.forEach[DateTime clock |
clock.sendCommand(ON)
]
end
Error:
2018-05-12 10:55:29.453 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'dmx.rules' has errors, therefore ignoring it: [20,37]: mismatched character ' ' expecting ']'
[20,48]: no viable alternative at input 'light'
[22,5]: mismatched input ']' expecting '}'
[24,3]: extraneous input '}' expecting 'end'
Rule:
rule "Pool Random Colors"
when
Item Pool_Random received command ON
then
//RAPIDLY CHANGE HSB FOR ALL LIGHTS ON
while(Pool_Random.state == ON) {
Pool_Lightstrip?.members.forEach[ColorItem light |
sendCommand(light, (((Math::random * 255).intValue)) + "," + (((Math::random * 100).intValue)) + "," + (((Math::random * 100).intValue)))
]
Thread::sleep(200)
}
end