hi all, I’ve written a custom component to listen on a TCP socket. This code was tested with hass version 0.92.2 and written for the Android App Easerhttps://me.ryey.icu/Easer/en/ (available in https://f-droid.org/) and its TCP Trip Event.
It works except when I restart Hass in the web UI. I think that the problem is that none of the on_remove methods are called when I restart Hass and so the subproccess started by the component are not killed. They must have the UI socket open. Do you have an example of an async custom component that uses the on_remove methods?
The full error message that I see when I restart hass with an enabled tcp_listener component is: ERROR (MainThread) [homeassistant.components.http] Failed to create HTTP server at port 8123: [Errno 98] error while attempting to bind on address ('0.0.0.0', 8123): address already in use
Any comments on my code would also be most welcome:
I replaced fork & listen with asyncio-stream and now restart works correctly. I’ve never used async before so please let me know if there are any problems in the code!