-
-
Notifications
You must be signed in to change notification settings - Fork 67
UDP async error #6
Comments
The Exception:
|
The problem is that you have classified your methods with async_ (i.e. async_update(), async_turn_on(), async_turn_off()), however it is clearly mentioned in https://developers.home-assistant.io/docs/asyncio_working_with_async that if you are doing so then you async methods should not do any blocking I/O, otherwise they will block the event loop of HA core. It has to be async through and through. An example of how async HTTP I/O is done by the alexa component: socket.sendto is a blocking operation, so is socket.recvfrom: We'll have to use DatagramTransport.sendto with awaits all the way back to async_update() Alternatively you can declare your component as synchronous (remove the async_ prefixes) and HA will then spawn threads to do the updates. The second problem is that there are too many redundant getPilot calls being done for each and every state when a single one could be done (e.g. even getConnection() does it). |
Something that can be used: https://pypi.org/project/asyncio-dgram/ |
Jup ... thats the problem with the async. My UDP implementation is fare away from be non-blocking. The problem with the getPilot I have to investigate. |
I'm almost 90% done with an async version of your module. will be sending a pull request soon :) |
The UDP connection creates a system timeout error in the HA environment.
The text was updated successfully, but these errors were encountered: