zxdavb / ramses_cc

HA integration for CH/DHW and HVAC systems that use the RAMSES II RF protocol
GNU General Public License v3.0
78 stars 17 forks source link

Design issue in `Broker.async_update()` #168

Open zxdavb opened 8 months ago

zxdavb commented 8 months ago

@trvrnrth

I'd like you to consider this:

So the code would become:

for device in self._devices + self._systems + self._zones + self._dhws:
    await device.async_device_update()  # instead of self._update_device(device)

Thus, in RamsesEntity.async_update() we can do I/O - e.g. we can address missing attrs, e.g. send_cmd(RQ|0004).

Also has advantage that device.async_device_update() can be invoked for an individual entity without waiting for the next broker cycle.

trvrnrth commented 8 months ago

I'm not sure I follow entirely. In the code snippet, the device at that point is currently a ramses_rf Entity with _update_device just reading its state and updating a corresponding device in the HA device registry.

I wouldn't expect a ramses_rf Entity to become responsible for updating the HA device registry so are you suggesting adding a new ramses_cc Device wrapper around the ramses_rf Entity that would take on that responsibility?

zxdavb commented 6 months ago

Is this causing #170, #166?