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
Xiaomi_ble reports battery status as unavailable #82168
Comments
Hey there @Jc2k, @Ernst79, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) xiaomi_ble documentation |
what device do you have?, Battery polling is only done for the plant sensor |
I don't see this with my plant sensor, so there must be an environmental factor. Could you turn the signal strength sensor on for your plant sensor and let me see what it looks like. Or maybe post a picture of your temperature graph when the battery is unavailable for a while? |
I have about 40 of the plant sensors. I have both the small versions, HHCCJCY01, and also the larger ones (GCLS002). Temperature and illuminance values are updating very often, no issue there, its just the battery levels. All sensors are within 10 feet of an esphome esp32 bluetooth proxy module. I am turning on the signal strength for a few of the sensors now, I will report back after it has had some time to collect data. |
So its getting battery readings here and there, just need to extend the amount of time it takes before the battery entity is reported to be unavailable. The warning it get is "This entity is no longer being provided by the xiaomi_ble integration. If the entity is no longer in use, delete it in settings." |
There are 2 types of unavailability. A device can disappear from the Bluetooth stack and become unavailable. This isn't driven by timers as such - there is a timer that drives checking in with the Bluetooth stack, but it's up to bluez stack to decide what is and isn't available. If it's not available in bluez it really isn't, you can't even try to connect to it. (AIUI the esp code works the same). This isn't helpful for advertisement driven stuff with slow advertisement intervals - they can literally turn their radios off for hours. So there is a second self calibrating mechanism that tracks the time between broadcasts for each mac. So if a device broadcasts every 2 hours then we'd only mark it unavailable if we haven't heard from it at least 2 and a bit hours. But the device that broadcasts every 10s can be marked unavailable after a minute. I don't know which of these applies to the plant sensor battery (forgot what I did, and on phone right now), but neither of them should be kicking in if your HA is receiving advertisements and the sensor is within connectable range of an esp proxy. And your graphs give the impression that that's all in order. |
This happens when you restart HA and there has been no successful poll since the restart and that's expected. |
Interesting feature request, would probably want an arch issue before I'd pick it up, unless there are already a couple of illuminance sensor doing something similar in other core integrations. |
Hi, I have this sensor: https://esphome.io/components/sensor/xiaomi_ble.html#hhccjcy01 |
Battery status is working for me again either since 2022.12.5 or 2022.12.6. |
I have the same problem on HA 2023.2.5 with my sensors, some battery data are gathered, but hours ago, all other sensor data are seconds or minutes old 🙈 |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
The problem
The integration as I understand it required active BT connection to pull battery level, so it only pulls this once per day to save battery. The problem is that after a couple of hours the integration reports to HA that battery level is Unavailable.
Need the battery level to not be marked unavailable until after lets say 48 hours or so.
I have tried with and without BT proxies. Tried ESPHome v10.2, and V11.b04
What version of Home Assistant Core has the issue?
11.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Xiaomi BLE
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: