I've implemented a custom component for Home Assistant, which opens the SocketIO stream and feed the event bus with it.
Shorted version:
async def async_setup(hass: HomeAssistant, config: dict):
sio = AsyncClient()
await sio.connect(...)
@sio.on("event")
async def _handler(data: dict):
hass.bus.async_fire(...)
hass.async_create_task(sio.wait())
return True
But when implemented this way it somehow blocks the initialization process. Dashboard is not populated until following line comes up in the log:
2022-08-27 19:45:43.586 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for bootstrap - moving forward
What I'm doing wrong? Should I resign from the async aproach and use threading instead?