mhthies / smarthomeconnect

Python 3 AsyncIO-based home automation and interfacing framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

knx: clear origin in local feedback when sending value to group address

mhthies opened this issue · comments

In KNX GroupVariable objects we re-publish each value update which is written to the object, effectively creating a "local feedback". This way, other objects subscribed to the GroupVariable receive the value update as it came from the KNX bus. However, we keep the origin list intact, such that the value update is not written back to the orginating object (or any other object in the update's path).

This behaviour helps avoiding feedback loops, but it poses two problems:

  1. It will be inconsistent with the MQTT interface, where we cannot prevent feedback (without origin reference), since the MQTT broker will return our sent messages without any hint about their origin.
  2. When a concurrent, conflicting update comes from the KNX bus, it will result in a inconsistent state of KNX bus devices and our internal variable (and even devices connected via other interfaces). (see also #27)

Thus, we should probably clear the origin value for the local value feedback, i.e. make it look like the value came straigt from the KNX bus.

This approach is not consistent with the existing semantics of Subscribable objects in SHC. It would e.g. produce infinite feedback loops when directly connecting a KNX group address and an MQTT topic bidirectional.

As the state consistency issues are (mostly) fixed with the approach in #36 now, we can drop this proposal and instead add additional logics to the upcoming MQTT interface to make sure it does keep the origin list.