I don’t think openHAB gives information about the source of an update (at least you could get information in debug-mode, because the binding itself would log additional informations, but that’s not what you want).
So you have to ensure that every source generates different updates, e.g. if you normally would define an item:
to ensure, that the light can be switched with different sources from all three buses, you have to set five Items:
Group MyItem
Switch MyItem_knx "Light knx" (MyItem) {knx="..."} //receive only
Switch MyItem_zwave "Light zwave" (MyItem) {zwave="..."} //receive only
Switch MyItem_mios "Light mios" (MyItem) {mios="..."} //receive only
Switch MyItem_UI "Light [%s]" (MyItem) //receive only
Switch MyItem_send "Light Relais" (MyItem) {whatever} //send only
The Group itself has to be persisted (not MyItem* but MyItem !).
And a rule:
var boolean MyLock=false
rule "MyItem"
when
Item MyItem_knx received command or
Item MyItem_zwave received command or
Item MyItem_mios received command or
Item MyItem_UI received command
then
if (!MyLock) {
MyLock = true
if (MyItem.lastUpdate.name!="MyItem_send") {
logInfo("MyItem","Command received from {}",MyItem.lastUpdate.name)
MyItem_send.sendCommand(receivedCommand)
if(MyItem_knx.state != MyItem_send.state) MyItem_knx.sendCommand(receivedCommand)
if(MyItem_zwave.state != MyItem_send.state) MyItem_zwave.sendCommand(receivedCommand)
if(MyItem_mios.state != MyItem_send.state) MyItem_mios.sendCommand(receivedCommand)
if(MyItem_UI.state != MyItem_send.state) MyItem_UI.postUpdate(receivedCommand)
}
Thread::sleep(1000)
MyLock = false
}
end
This is not tested, but in theory, you would get the information because every binding has its own item. The rule is then to synchronise the Items. The rule will be triggered multiple times, therefore you have to lock the rule. I’m totally sure this whole thing is very hacky …
One of the goals of OH is to provide an abstraction between the devices/things and the logic that drives your home automation. From that perspective your rule shouldn’t care where the event came from, only that the event occurred. If the rule does something different based on where the event came from, you should separate your config into separate Items so you get different events based on where it is coming from.
Assuming that it is possible to preserve the source of an event and make it available to the rule easily, I’m not certain it would be accepted in a PR as it goes against this abstraction. In OH 2 there is even more layers of abstraction between the actual device/sensor and the rules adding at least one more layer that the info would have to pass through.
Given this, my question back to you is what are you trying to achieve?
I’ve found a lot of people come to this forum asking a technical question like this having already formulated an approach to solve their problem but once their end goals are revealed we can suggest an easier or alternative way to reach the end goal. One that doesn’t require additions or changes to the code.