home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.08k stars 30.57k forks source link

xiaomi-ble Garden-Sensor (GCLS002) does not expose Battery SoC to the integration #111950

Closed ChristophCaina closed 4 months ago

ChristophCaina commented 8 months ago

The problem

I have several Plant-Sensors which are working nicely with the Xiaomi Integration and expose their information over Bluetooth (device: HHCCJCY01) ... with Firmware version 3.2.6

I also have a large "Garden-Sensor" - device GCLS002 with Firmware 3.3.6 It can be charged per USB cable, comes with a fixed battery... I can see, that the battery SoC will be shown in the FlowerCare app, but it isn't available within the Xiaomi integration of HomeAssistant.

2024-03-01_09h36_41

Any steps I can do to provide required information to implement the Battery Sensor for this device?

What version of Home Assistant Core has the issue?

2024.2.0

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

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

home-assistant[bot] commented 8 months ago

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)

AwokenByMyFears commented 7 months ago

I am also having this problem. Not a huge deal but would be awesome if there's a way to fix this.

hapklaar commented 7 months ago

Would love to have battery stats as well. This device is also known as Xiaomi Flower Care Max (HHCCJCY09)

Ernst79 commented 7 months ago

In BLE monitor, I didn't find battery data in the passive BLE advertisements. It might be available by connecting to the device, similar as we now do for the other plant sensor.

ChristophCaina commented 6 months ago

In BLE monitor, I didn't find battery data in the passive BLE advertisements. It might be available by connecting to the device, similar as we now do for the other plant sensor.

Let me know how I can assist :)

hapklaar commented 5 months ago

@Ernst79 anything we can do or test to expedite this?

Ernst79 commented 5 months ago

I'm not familiar with setting up connections to BLE devices. I know there is some code already in xiaomi BLE to get the battery state for the other plant sensor. But I don't have the time and skills to add this, Hopefully someone else can help.

ChristophCaina commented 5 months ago

Hi,

I was going through the HA Logs for another issue, and found this information. I don't know, if this is helpful or not, but... maybe.... ?

2024-05-31 10:37:26.533 INFO (MainThread) [xiaomi_ble.parser] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 131, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100100, UNKNOWN dataobject in payload! Adv: 7120bc0383e2586d8d7cc40d0b100100

2024-05-31 10:37:27.528 INFO (MainThread) [xiaomi_ble.parser] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 85, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100100, UNKNOWN dataobject in payload! Adv: 7120bc035546596d8d7cc40d0b100100

2024-05-31 10:37:52.824 INFO (MainThread) [xiaomi_ble.parser] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 136, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100100, UNKNOWN dataobject in payload! Adv: 7120bc0388e2586d8d7cc40d0b100100

2024-05-31 10:40:39.018 INFO (MainThread) [xiaomi_ble.parser] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 95, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100100, UNKNOWN dataobject in payload! Adv: 7120bc035f46596d8d7cc40d0b100100

2024-05-31 10:40:39.838 INFO (MainThread) [xiaomi_ble.parser] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 74, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100100, UNKNOWN dataobject in payload! Adv: 7120bc034a0c606d8d7cc40d0b100100

And many others with the same payload but different FnCnt ...

Rickth64 commented 4 months ago

I'm not familiar with setting up connections to BLE devices. I know there is some code already in xiaomi BLE to get the battery state for the other plant sensor. But I don't have the time and skills to add this, Hopefully someone else can help.

This needs to be done in Bluetooth-Devices/xiaomi-ble, I can probably create a PR over there.

Rickth64 commented 4 months ago

See Bluetooth-Devices/xiaomi-ble#79

Ernst79 commented 4 months ago

Released as 0.30.0 in xiaomi-ble

ChristophCaina commented 4 months ago

Released as 0.30.0 in xiaomi-ble

So, now ha needs to use 0.30.0 of the library, right?

Ernst79 commented 4 months ago

Yep

hmmbob commented 4 months ago

Just a short message confirming that 0.30.0 fixes the issue:

image

It'll very likely be part of 2024.7, given the time of the merge (I patched my running container to use 0.30.0 for testing)

hapklaar commented 3 months ago

Curious, did it make 2024.7? Just updated, but see no battery stat yet.

ChristophCaina commented 3 months ago

yes, it did and it is working (except, my bt proxy has issues with the traffic...) grafik

It might take some time, until the new sensor will be added.

hmmbob commented 3 months ago

image

Jupz