Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python BLE discover all UUID characteristics

So far, this code is returning me the UUID of the service. But I have several characteristics inside of it, can I discover their UUID?

import asyncio
from bleak import BleakScanner

async def run():
    devices = await BleakScanner.discover()
    for d in devices:
        print(d.metadata)
            
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
like image 256
Escaga Seen Avatar asked Nov 02 '25 08:11

Escaga Seen


1 Answers

The discover is only getting the advertising information from the device. At that stage your client will not have resolved the services and know about the characteristics. That information is only available once the client has connected to the device. Browsing the documentation it looks like you get the information you want with the services property on the client.

Example at:

https://github.com/hbldh/bleak/blob/develop/examples%2Fservice_explorer.py

like image 138
ukBaz Avatar answered Nov 03 '25 22:11

ukBaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!