OpenVoiceOS / ovos-PHAL-plugin-homeassistant

HomeAssistant PHAL Plugin for OpenVoice OS
Apache License 2.0
10 stars 3 forks source link

Uncaught exception if HomeAssistant cannot be reached #56

Closed NeonDaniel closed 2 months ago

NeonDaniel commented 5 months ago

I believe the root cause for this error is a change in my network/nginx configuration, but in any case a non-static IP address could case a similar issue and should probably be caught/handled more nicely.

2024-05-07 15:09:14.734 - enclosure - ovos_PHAL_plugin_homeassistant.logic.socketclient:_connect:64 - ERROR - 
Traceback (most recent call last):
  File "/home/neon/venv/lib/python3.10/site-packages/websockets/legacy/client.py", line 663, in __await_impl__
    _transport, _protocol = await self._create_connection()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
    return await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/neon/venv/lib/python3.10/site-packages/ovos_PHAL_plugin_homeassistant/logic/socketclient.py", line 48, in _connect
    self.websocket = await websockets.connect(uri)
  File "/home/neon/venv/lib/python3.10/site-packages/websockets/legacy/client.py", line 659, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
2024-05-07 15:09:14.741 - enclosure - ovos_PHAL_plugin_homeassistant.logic.socketclient:run:246 - INFO - self.loop.is_running=False