chkuendig / hass-amphiro-ble

🚿 Amphiro Digital Hand Shower component for Home Assistant
https://christian.kuendig.info/posts/2023-01-hass-amphiro/
MIT License
8 stars 2 forks source link

Sensors become Unavailable after 15 minutes #10

Open mihsu81 opened 3 months ago

mihsu81 commented 3 months ago

Hi @chkuendig,

The sensors become Unavailable after 15 minutes of not receiving data from the shower head. HA shows a notification that the integration amphiro_ble doesn't provide these entities anymore. Is this expected behaviour? Is there any way to have the sensors keep their values? Thanks in advance.

image

chkuendig commented 3 months ago

I think thats the regular behaviour for sensors that arent continuously active. This also happens for other devices if I unplug them. (the showerhead loses power if its not running)

mihsu81 commented 3 months ago

I have seen other integrations have implemented ways to restore the state of the sensor after a restart. Like https://github.com/custom-components/ble_monitor

image

If you think it is too difficult to add in this integration, do you have any examples of your approach in your instance of HA to get around this limitation?

Thanks.

mihsu81 commented 3 months ago

Also, the sensors of the native Xiaomi BLE integration keep their last state after a restart. Or the last measurement from hours ago, like in the case of a Xiaomi bathroom Scale. So I guess something must be missing from the integration that adds this functionality.

mihsu81 commented 2 weeks ago

@chkuendig a solution for something similar was implemented in https://github.com/codyc1515/ha-yeelock/pull/17 for the ha-yeelock custom integration. from homeassistant.helpers.restore_state import RestoreEntity