unfoldedcircle / core-simulator

Remote-core simulator releases
30 stars 2 forks source link

Home Assistant demo server: sensors don't work anymore #12

Closed zehnm closed 1 year ago

zehnm commented 1 year ago

After updating Home Assistant to the latest version the sensor entities are no longer working. The sensor's value doesn't reach the remote-ui anymore. After checking the returned entity data with the Core-API, the sensor value is indeed missing. Something must have changed in the Home Assistant API.

zehnm commented 1 year ago

Debugging the message communication between our integration driver and Home Assistant 2023.2.5 revealed, that event subscription for sensor entities is still working, BUT the initial value right after sending subscribe_events is no longer sent by Home Assistant. This might not have been a feature but a bug in an old version that has been fixed in the meantime :-) The state_changed events are only sent once a sensor value has actually changed.

It looks like that the only way is to send get_states right after event subscription to fetch the current state of all entities. Unfortunately this call returns all entity data from Home Assistant without any filter options. Time to submit an issue to request filter or paging options, since the response can break the max WebSocket message payload size for large setups! (Unless WS continuation frames are now supported).

zehnm commented 1 year ago

Fixed in next remote-core simulator release.

There was another issue: get_states was already issued from the core after the integration connection was authenticated. But this was too early since the Home Assistant connection was not yet fully established.