Request item states of aggregated GROUP

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!


rule "Wartung: Fehler-Items"
    Time cron "0 45 9,17 * * ?" or
    Item Whg_Wartung_Trigger received command ON
    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)

Let me know if you have any questions!

For more details see -> forEach


Super thanks - works like a charm!