Guard-fenix_CodigoFenix_2026/_Sort/ble/V001.py

19 lines
554 B
Python

import asyncio
from bleak import BleakScanner, BleakClient
SERVICE_UUID = "7e2a0001-1111-2222-3333-444455556666"
CHAR_UUID = "7e2a0002-1111-2222-3333-444455556666"
def handle_notify(sender, data):
text = data.decode(errors="ignore")
print("RX:", text)
async def main():
print("Connecting to", "10:51:DB:1B:E7:1E")
async with BleakClient("10:51:DB:1B:E7:1E") as client:
print("Connected")
await client.start_notify(CHAR_UUID, handle_notify)
await asyncio.sleep(120) # run for 1 minute
asyncio.run(main())