Closed mkmer closed 11 months ago
I am not sure I understand the need for this change. fetch_data()
is only called on startup when HA calls connect()
, so there is no need to call the attr changed callback there.
It is also called when the socket reconnects:
which is mapped to this: https://github.com/abmantis/whirlpool-sixth-sense/blob/f217ca550a275e1a04fd567a8efd092ad2968bce/whirlpool/eventsocket.py#L138
When the event socket reconnects, we don't "know" the states for sure, so we do a fetch to make sure everything is up to date. Unfortunately, we don't tell HA that there is new data to update when this happens.
This will also allow us to drive 1 timed update function and still trigger all other entities (The bandaid for a crappy event socket)
It is also called when the socket reconnects: https://github.com/abmantis/whirlpool-sixth-sense/blob/f217ca550a275e1a04fd567a8efd092ad2968bce/whirlpool/appliance.py#L192C8-L192C8 which is mapped to this:
When the event socket reconnects, we don't "know" the states for sure, so we do a fetch to make sure everything is up to date. Unfortunately, we don't tell HA that there is new data to update when this happens.
This will also allow us to drive 1 timed update function and still trigger all other entities (The bandaid for a crappy event socket)
Ah I see! Makes sense!
Thanks!
Can we get a release in pypi for this? Looking to activate the polling feature in HA and this is necessary for HA to update all entities. Thanks!
@mkmer sure! I just released it as v0.18.4.
Need to tell listeners when new data is fetched - found when restarting the socket and calling fetch_data() HA was not notified of updated entities until an event message was received.