core icon indicating copy to clipboard operation
core copied to clipboard

Xiaomi BLE missing battery sensor

Open chemelli74 opened this issue 1 year ago • 13 comments

The problem

Xiaomi BLE doesn't create battery sensor for HHCCJCY01 devices. All other sensors are created and working properly:

image

What version of Home Assistant Core has the issue?

2024.2.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Xiaomi BLE

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xiaomi_ble/

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

chemelli74 avatar Feb 22 '24 12:02 chemelli74

Hey there @jc2k, @ernst79, mind taking a look at this issue as it has been labeled with an integration (xiaomi_ble) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of xiaomi_ble can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign xiaomi_ble Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


xiaomi_ble documentation xiaomi_ble source (message by IssueLinks)

home-assistant[bot] avatar Feb 22 '24 12:02 home-assistant[bot]

How long have you had that sensor? If longer than a few days, can I see the graph for signal quality and can you confirm there are no logs from the integration?

For whatever reason, that sensor does not broadcast battery information.

There is a battery sensor that it tries to poll once a day only (as the sensor is not only usually incorrect, but polling it uses a lot of battery). However polling requires a much stronger signal. I'd expect -83 to be a little bit unreliable with this sensor. I would expect to see something in the logs if the poll failed. If nothing in the logs, check again in 24h.

Jc2k avatar Feb 22 '24 12:02 Jc2k

HI, thx for the quick reply.

Device is there since a week (others devices for even more). I can immagine signal strength is not good, but I would expect it to be at least created. If it needs a minimum strength for a long timeframe, I suggest to add this info to the documentation.

chemelli74 avatar Feb 22 '24 13:02 chemelli74

Xiaomi BLE integration only creates a battery sensor if it receives the actual battery data. So it can take 24 h, and, as said by @Jc2k, battery data is only collected by connecting to the device (which is done once a day), and requires a good connection. All other data (temperature, etc) is received passively, and is broadcasted at a frequent interval (once per minute).

Ernst79 avatar Feb 22 '24 13:02 Ernst79

Yup, I know the difference between actie and passive, but what is missing in the equation is "requires a good connection". Something like: "it needs at least -60 dBm for at least 60 minutes around 11pm" would help ;-)

chemelli74 avatar Feb 22 '24 13:02 chemelli74

I can confirm the battery sensor is gone. I have 2 of these sensors for more than a year. The battery sensor never gave any problem but now it is gone. I tried to delete and add the sensors again but that didn't help. I have them laying next to the Bluetooth dongle (about 20 cm) for more than a week. Signal strength about -60dBm.

WebfinityDesign avatar Feb 29 '24 12:02 WebfinityDesign

Hi, can you at least add some debug log lines to help understanding why that sensor is no more created ? Thank you in advance

chemelli74 avatar Apr 15 '24 15:04 chemelli74

Hi,

I think there is something to be fixed somewhere in the code path, as using esphome with myhomeiot_ble_client works perfectly. I see both firmware and battery status.

chemelli74 avatar Jun 21 '24 13:06 chemelli74

FWIW, still works fine here.

Screenshot 2024-06-21 at 15 19 10 Screenshot 2024-06-21 at 15 19 46

Jc2k avatar Jun 21 '24 14:06 Jc2k

My battery level is three, but it always shows 100%. It never changes.

amzaldua avatar Jul 11 '24 06:07 amzaldua

I have two HHCCJCY01 devices since April and the battery sensor never showed up. image

Neocray avatar Jul 17 '24 11:07 Neocray

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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still looking for a feedback

chemelli74 avatar Oct 15 '24 12:10 chemelli74

I have the same problem; I don't see battery information. All the other sensors are sending data.

paganl avatar Oct 21 '24 11:10 paganl

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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Issue not yet solved

chemelli74 avatar Jan 19 '25 16:01 chemelli74

Three of these sensors in my HA and all three never showed any battery sensor. I thought this is normal before I realized that the official app shows this information.

dreimer1986 avatar Apr 15 '25 11:04 dreimer1986

I have the same issue with 6 of these sensors running for several weeks.

I use them via Shelly proxies and I have tried both passive and active mode in the Shelly integration.

Signal strength is between -49 and -70, so this should not be an issue.

In the logs I get the following (not sure if at all relevant):

Logger: bluetooth_auto_recovery.recover
Source: runner.py:154
First occurred: 14:14:31 (80 occurrences)
Last logged: 14:44:36

Could not reset the power state of the Bluetooth adapter hci0 [E8:47:3A:FD:8A:C5] due to timeout after 5 seconds
Could not cycle the Bluetooth adapter hci0 [E8:47:3A:FD:8A:C5]: [Errno 1] Operation not permitted
Bluetooth management socket connection lost: [Errno 22] Invalid argument
Closing Bluetooth adapter hci0 [E8:47:3A:FD:8A:C5] failed: [Errno 9] Bad file descriptor

headtr1ck avatar Apr 22 '25 12:04 headtr1ck

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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still the case for 2025.7.2

headtr1ck avatar Jul 22 '25 12:07 headtr1ck

Still not working with Xiami BLE integration, but working fine via ESPHOME.

Image

chemelli74 avatar Jul 22 '25 12:07 chemelli74

I only have battery info for a few sensors, and they are all located in the same planter, so I wouldn't imagine signal strength to vary too much between them

Image

mattaustin avatar Sep 17 '25 03:09 mattaustin