trying to recode a gatt command to work in python…anything really im not picky, tho the example i found uses bleak
gatttool -b 34:85:18:6A:52:52 --char-write-req -a 0x0030 -n a5000008009c47ad000310010111010aff0100a8
Id prefer to just have it send the gatt code above instead of the checksum if thats possible
import asyncio
from bleak import BleakClient
from crccheck.crc import Crc8ITU
address = "34:85:18:6A:52:52"
async def main(address):
async with BleakClient(address) as client:
header = bytes.fromhex("a50000080")
command = bytes.fromhex("0536f0e000310010212010")
params = bytes.fromhex("aff01209a")
crcinst = Crc8ITU
crcinst.process(header)
crcinst.process(command)
crcinst.process(params)
model_number = await client.write_gatt_char("70d510012c7f4e75ae8ad758951ce4e0", header + command + params + crcinst.finalbytes())
asyncio.run(main(address))