Reading individual KNX source addresses


I have multiple KNX devices sending messages on the same group address, how can I distinguish between the different sources when receiving a command in openHAB rules?

It depends on how closely together the commands are received. If you have persistence setup you can do a little hack like the following. Otherwise you are out of luck and have to create separate rules for each Item in the group.

Thread::sleep(250) // experiment to find a time that works for you, gives persistence enough time to save the value
val myItem = MyGroup.members.sortBy[lastUpdate].last // gets the most recently updated Item

Hi and thanks for the help.

But I´m not worried about the rate of messages. I have multiple fire detectors on this one group, and they will only send commands if they detect a fire.

I want openhab to listen to this group and notify my if there is a fire. To make more sense of the alarm it´s useful to know which detector is alerting me. Or which room there might be a fire in.

So I need a way to find out who sent the group message. If I could read the KNX source address it would be easy!

I don’t think you understand.

My solution provided above relies on the new state of your Item being saved to persistence. So we have to wait the 250 milliseconds to give persistence a change to save its state. Then we get the most recently updated/saved to persistence Item from the group and you have the Item that triggered the group.

However, if you have two or more members of the group that generate an alert within 250 milliseconds of each other then you have a race condition and you have no guarantee which one will complete being saved to persistence first, but which ever one IS saved to persistence first will be the Item that the rule things triggered the Group for BOTH times the rule is triggered, essentially losing the other.

So if this isn’t a problem then my two line solution above will work