Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design issue in Broker.async_update() #168

Open
zxdavb opened this issue Feb 12, 2024 · 2 comments
Open

Design issue in Broker.async_update() #168

zxdavb opened this issue Feb 12, 2024 · 2 comments
Assignees

Comments

@zxdavb
Copy link
Owner

zxdavb commented Feb 12, 2024

@trvrnrth

I'd like you to consider this:

  • Every update cycle, Broker.async_update() invokes self._update_device(device)
  • instead, I believe that much of the code in that method should be in device.async_update()

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).

  • although most of Broker._update_device(device) would end up in the base class RamsesEntity

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

@trvrnrth
Copy link
Contributor

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
Copy link
Owner Author

zxdavb commented Apr 9, 2024

Is this causing #170, #166?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants