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

Sensors become Unavailable after 15 minutes #10

Closed
mihsu81 opened this issue Jun 22, 2024 · 6 comments · Fixed by #11
Closed

Sensors become Unavailable after 15 minutes #10

mihsu81 opened this issue Jun 22, 2024 · 6 comments · Fixed by #11

Comments

@mihsu81
Copy link

mihsu81 commented Jun 22, 2024

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

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

mihsu81 commented Jun 24, 2024

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

mihsu81 commented Jun 30, 2024

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

mihsu81 commented Sep 19, 2024

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

@gilcu3
Copy link
Contributor

gilcu3 commented Dec 4, 2024

@chkuendig thank you for this integration. I have recently began using it and it works like a charm.

Regarding the topic of this issue, I have to agree with @mihsu81, I think the expected behavior for bluetooth sensors that are not always connected is to retain the last value available. One official integration that comes to my mind that has this behavior is oral-b. It tracks quite similar sensors (time, and others) while the tooth brush is working, then keeps them until the next time they are used, even if there are reboots.

Would you consider again adding this feature, or at least accepting PRs adding it? I would be happy to do the later if you are willing to accept it.

@chkuendig
Copy link
Owner

Happy to merge a PR, I so far just didnt have time to look into this myself.

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

Successfully merging a pull request may close this issue.

3 participants