getsenic / gatt-python

Bluetooth GATT SDK for Python
MIT License
318 stars 86 forks source link

Cannot get characteristics of battery service #41

Open Firefox2005 opened 5 years ago

Firefox2005 commented 5 years ago

I'm struggling with reading the battery value of a peripheral. The peripheral is based on a Nordic nrf52 and implements the battery service 0x180F and a read characteristic.

After connecting to the device I can find the battery service, but it does not contain any characteristics, although I can confirm that they exist with the 'nrfConnect' app.

Has anyone succeeded in reading the battery value of a peripheral or in discovering its battery characteristics?

Snevzor commented 5 years ago

Have you previously connected to the peripheral using Bluez without the battery service implemented? Bluez stores the resolved services for each peripheral and does not resolve again unless you specifically remove them.

Firefox2005 commented 5 years ago

Yes indeed! But unfortunately that did not do the trick. I deleted the cache and also checked with another device where it didn't work as well.

weliem commented 4 years ago

The Battery Service and its characteristics are hidden by the battery plugin that is loaded at startup of bluetoothd.

You can simply tell bluetoothd to not load the battery plugin and you'll be able to access the Battery Service. To do so startup bluetoothd with '-P battery'. Edit the bluetooth.service file to do this.