import asyncio from bleak import BleakScanner, BleakClient ADDRESS = "" SERVICE = "65970000-4bda-4c1e-af4b-551c4cf74769" # Descriptor UUIDs CLIENT_CHARACTERISTIC_CONFIGURATION = "00002902-0000-1000-8000-00805f9b34fb" CHARACTERISTIC_USER_DESCRIPTION = "00002901-0000-1000-8000-00805f9b34fb" async def main(): # devices = await BleakScanner.discover() # for d in devices: # print(d) device = await BleakScanner.find_device_by_address(ADDRESS, timeout=20.0) if not device: raise BleakError(f"A device with address {ble_address} could not be found.") async with BleakClient(device) as client: for service in client.services: if service.uuid == SERVICE: for characteristic in service.characteristics: description = 'Unknown' for descriptor in characteristic.descriptors: if descriptor.uuid == CHARACTERISTIC_USER_DESCRIPTION: descriptor_value = await client.read_gatt_descriptor(descriptor.handle) description = descriptor_value.decode('UTF-8') char_value = await client.read_gatt_char(characteristic.uuid) print(f"{description}: {int.from_bytes(char_value, byteorder='little', signed=False)} (0x{char_value.hex()})") asyncio.run(main())