The Candela pairs every time
Hey,
Nice work! I have a little question. I want to use your code to integrate some Candelas with the Domoticz Home Automation System. But from the moment I send the command it takes around 7 seconds for the Candela to receive it. This is probably because the Candela doesn't stay connected all the time but it pairs every time I send a command.
Is there any way to make it faster? If I use this in a home automation system it's kinda strange to touch a switch and eat some popcorn while the light will turn on at some moment.
The code is very nice!
Hi,
there are two potential ways to make it faster:
-
Instead of autodetecting the charasteristics to write to, add a type option to skip this. It will be a couple of calls less on the device with a slight speed up. Also, as you mentioned, the pairing procedure is done for every new connection even when it may not be necessary. This is something I have had in my todo list, but I don't have time to work on it in the foreseeable future, so if you want, PRs are very welcome!
-
Keep the connection alive, this will make the changes (and updates from the lamp) instant. If you are interacting through the library interface, you can simply keep the bluetooth connection alive. This will likely consume a bit more battery, will block access from other devices (e.g. from the official app), and the amount of bluetooth devices your computer is also limited.
hi i think that in home assistant there is a problem with python because the pip install construct==2.9.41 and is not pip install construct==2.9.25. there is a possibilty to start this /config/custom_components with version 2.9.25. thank you
@matteos1 that was likely fixed by #28, that is unrelated to this issue.