[SOLVED] Can I use state of the member of the group in rule directly?

theory:
I have several items which belongs to the group

If I use this

rule "whatever"
when
    Member of Motion changed from OFF to ON
then
    //do stuff
end

Is it possible to use exact Item which triggered group to work with? For example to alert where motion was triggered without need of separate rule to find out which was triggered?

Yes. Use triggeringItem in the DSL or ir.getItem(event.itemName) in Jython.

cool for state, but how do I know the name of the Item?
as they are all switches simple ON/OFF is not enough

triggeringItem.name for DSL or event.itemName for Jython

thanks! :slight_smile:

1 Like

Just to add a bit more clarity, in Rules DSL, triggeringItem is the Item that triggered the Rule. So any of the methods and data members that are available on any Item (e.g. MyItem.name, MyItem.lastUpdate, etc.) are available on triggeringItem.

In Jython, you usually access of that stuff using different function calls passing the name of the Item.

1 Like