Open zxdavb opened 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?
Is this causing #170, #166?
@trvrnrth
I'd like you to consider this:
Broker.async_update()
invokesself._update_device(device)
device.async_update()
So the code would become:
Thus, in
RamsesEntity.async_update()
we can do I/O - e.g. we can address missing attrs, e.g. send_cmd(RQ|0004).Broker._update_device(device)
would end up in the base classRamsesEntity
Also has advantage that
device.async_device_update()
can be invoked for an individual entity without waiting for the next broker cycle.