Closed EkoFreshFTech closed 1 month ago
Hi, I wrote a script to recieve data via async callback. My problem is that I get unusual ouputs. I tried to print the power from my hometrainer.
from bleak import BleakClient import asyncio async def callback_data(sender, data): print("Rohdaten:", data) async def connect_and_data(): cyc_power_uuid = '00002a63-0000-1000-8000-00805f9b34fb' address = 'C5:B3:F0:FB:9A:1E' try: async with BleakClient(address) as client: await client.start_notify(cyc_power_uuid, callback_data) await asyncio.sleep(10) await client.stop_notify(cyc_power_uuid) except Exception as e: print(f"Fehler beim Verbinden oder Lesen: {e}") except KeyboardInterrupt: await client.stop_notify(cyc_power_uuid) # Starte die asynchrone Funktion asyncio.run(connect_and_data())
Output:
Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b') Rohdaten: bytearray(b'1\x00\x00\x004\xeb\x02\x00\x00\x00p \x00r\x1b')
How do I decode this? Thanks for any help :D
PS: is there any chance of increasing the rate of data sent? Right now i get 1 Hz, but i try to reach around 5 Hz.
You can find the representation of the data in the GATT Specification Supplement. Search for "Cycling Power Measurement" in the document.
Description
Hi, I wrote a script to recieve data via async callback. My problem is that I get unusual ouputs. I tried to print the power from my hometrainer.
Output:
How do I decode this? Thanks for any help :D
PS: is there any chance of increasing the rate of data sent? Right now i get 1 Hz, but i try to reach around 5 Hz.