Dnpwwo wrote: ↑Wednesday 18 October 2017 6:28
@moroen,
I would recommend against the 'switch to aiocoap' because the Python Framework does not support asynchronous operations and libraries.
The framework is single threaded, does not enable Python threads in the interpreter, nor it does not use the Python Global Inter Lock. The code within Domoticz is thread safe only where it interacts with the Python garbage collector.
This is documented on the wiki page explicitly.
What problem are you trying to solve by using aiocoap?
Thanks for the input!
There is no async code in the plugin itself. In order to support COAP, the solution consists of two separate parts. The plugin (plugin.py) communicates with an "adapter" using telnet, so the plugin is single threaded and synchronous, without any external libraries. All the "heavy lifting" is done by onMessage and onCommand.
The adapter then uses COAP to talk to the IKEA-gateway, and send appropriate messages back to the plugin. I'm currently considering using aiocoap for the adapter, in order to mimmize the impact on the gateway when observing changes.
In time I would like to see the the plugin-system support COAPS as a communication protocol, but that's far beyond my expertice!
Regards,
M