gatt-python
gatt-python copied to clipboard
Cannot get characteristics of battery service
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?
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.
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.
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.