Bluetooth-Devices / sensorpush-ble

Parser for SensorPush BLE devices
MIT License
0 stars 1 forks source link

Battery volt #28

Open ZyberSE opened 3 months ago

ZyberSE commented 3 months ago

It would be great if we could have battery voltage included from the sensors, without it's tricky to be proactive with battery changes.

bdraco commented 3 months ago

All of this library is reverse engineered, so if you know how to get the battery voltage out of the advertisement, please share

ZyberSE commented 3 months ago

I haven't tried it myself but it seams to be in the documentation, could that could be helpful?

https://www.sensorpush.com/bluetooth-api

bdraco commented 3 months ago

I haven't tried it myself but it seams to be in the documentation, could that could be helpful?

https://www.sensorpush.com/bluetooth-api

It looks like they only have docs for GATT but nothing for the advertisement

bdraco commented 3 months ago

Since they are publishing the docs for GATT, maybe they will do the same for the advertisement, if you contact them

ZyberSE commented 3 months ago

I'll see what info I can get, I'll keep you posted. Thank!

ZyberSE commented 2 months ago

I've had some discussions with the SensorPush team and they do want to help but are for some reason unable to share the protocol specs for the original sensor. Though they told me to check this:

It's possible some of the characteristics are the same as the HT.w models. What do you get when you get this characteristic: EF090007-11D6-42BA-93B8-9DD7EC090AA9?

bdraco commented 2 months ago

That’s not going to help since this library only reads advertisement data and that’s a GATT characteristic

relevante commented 1 month ago

Hey all, I'm the lead developer at SensorPush. Unfortunately the battery info just isn't in the advertisement data. The only way to get it, at least at the present time, is via the GATT characteristic. Our apps periodically connect to fill any gaps in the data history, and when they do they just grab the battery status, so for that use case there was no need to broadcast it. As we integrate with more other systems, circumstances are sometimes of course a bit different.

We're big Home Assistant fans and I'm an active user, so let me know if I can ever be of assistance. We do have some new sensor hardware on the way. I'll try to put a pull request together to add support for it, and @bdraco, if you'd like to coordinate offline to get some samples to test, we'd be happy to set you up. Thanks for all your work on this. It's really awesome!

bdraco commented 1 month ago

@relevante feel free to reach out on discord (same handle) or nick@home-assistant.io

Thanks

bdraco commented 1 month ago

As far as a PR to poll chars, you could lift https://github.com/Bluetooth-Devices/xiaomi-ble/blob/a9d8e90026d131b69a34db5b0821432e98e1e787/src/xiaomi_ble/parser.py#L2035 https://github.com/Bluetooth-Devices/xiaomi-ble/blob/a9d8e90026d131b69a34db5b0821432e98e1e787/src/xiaomi_ble/parser.py#L2053

bdraco commented 1 month ago

For the HA side you could mostly lift https://github.com/home-assistant/core/commit/6ad27089468e551ce4fb33021684c5366ce1d4f9 (and the subsequent updates)

relevante commented 1 month ago

Thanks @bdraco. I've got a busy week next week but will try to implement battery polling soon after. Will also get in touch via email re: getting you some test hardware for the new model.