Aritzherrero4/python-trionesControl

Writing data to handles is no reliable, use UUID instead

Closed this issue · 1 comments

mtttz commented

Your code does not work for my devices, as the correct handle is different.
Using the UUID 0000ffd9-0000-1000-8000-00805f9b34fb instead fixes this issue and should work for everyone.

Also there are people saying that handles are not meant to be used by applications:

The Android BLE developers chose to use UUID as the characteristic identifier in GATT API's; handles are not directly exposed to applications. Internally, Android maps UUID's to handles and uses handles to access characteristics, but apps have no need to know the handle.

https://esp32.com/viewtopic.php?t=830#p3501

Also, one of the forks of this repos seems to have been created solely to change the handle.

So instead of
device.char_write_handle(0x0009, payload)
use
device.char_write("0000ffd9-0000-1000-8000-00805f9b34fb", payload)

Thank you for the explanation and references. I have checked the PR and it works fine with my lights.