rule "Kodi check"
when
Item Kodi_ARZ changed to ONLINE
then
loginfo("kodi.rules", "Kodi ARZ is ONLINE")
end
I see this in the logs:
2018-01-07 12:34:20.583 [hingStatusInfoChangedEvent] - 'kodi:kodi:Kodi_ARZ' changed from OFFLINE to ONLINE
But the rule runs into error:
2018-01-07 12:47:29.069 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'test.rules' has errors, therefore ignoring it: [3,29]: no viable alternative at input 'OFFLINE'
[3,40]: no viable alternative at input 'ONLINE'```
Could someone give me a hint how the rules must be configured?
rule "Kodi check"
when
Item kodi__ITEM__ changed
then
var thingStatus_Kodi_ARZ = getThingStatusInfo("kodi:kodi:Kodi_ARZ")
if ((thingStatus_Kodi_ARZ !== null) && (thingStatus_Kodi_ARZ.getStatus().toString() == "ONLINE")) {
loginfo("kodi.rules", "Kodi ARZ is ONLINE")
}
end
Yes that works of course “Thing Based Trigger” … what did not work were only thing.state in the then part. My mistake
rule "Kodi check"
when
Thing Kodi_ARZ changed to ONLINE or
Thing Kodi_ARZ changed to OFFLINE
then
var thingStatus_Kodi_ARZ = getThingStatusInfo("kodi:kodi:Kodi_ARZ")
if ((thingStatus_Kodi_ARZ !== null) && (thingStatus_Kodi_ARZ.getStatus().toString() == "ONLINE")) {
loginfo("kodi.rules", "Kodi ARZ is ONLINE")
} else {
loginfo("kodi.rules", "Kodi ARZ is OFFLINE")
}
end