Hello, in my (openhab2) items file I have defined a Group:Switch:OR(ON,OFF) generalAlarm "Alarm-Situation [%d]" <siren>
field. In my rule I check it with when Item generalAlarm changed from OFF to ON
- how can I access the state of the item/the items that belong to that group that threw the alarm? I currently have 6 switches and the list will be growing and I would like to avoid to report all their states with a case or something like this. Thanks for help in advance!
Hey!
rule "Wartung: Fehler-Items"
when
Time cron "0 45 9,17 * * ?" or
Item Whg_Wartung_Trigger received command ON
then
logInfo(filename, "Wartung - Fehler-Items läuft...")
gError.members.forEach(item | {
if (item.state != "NO_FAULT" && item.state != "NO_ERROR") {
logWarn(filename, "Wartung - Fehler-Item FEHLER: " + item.label + ": " + item.state)
}
}
)
end
Let me know if you have any questions!
For more details see https://eclipse.org/xtend/documentation/203_xtend_expressions.html#operators -> forEach
More: http://jnario.org/org/jnario/jnario/documentation/20FactsAboutXtendSpec.html
Super thanks - works like a charm!