From time to time, the TrueNAS integration times out during startup and does not automatically recover without manual action. Manually reloading the integration fixes it, or another HA restart.
2023-04-13 11:33:12.269 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry truenas.local for truenas
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 655, in __await_impl_timeout__
return await self.__await_impl__()
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 662, in __await_impl__
await protocol.handshake(
File "/usr/local/lib/python3.10/site-packages/aiotruenas_client/websockets/protocol.py", line 73, in handshake
result = await self._authenticate()
File "/usr/local/lib/python3.10/site-packages/aiotruenas_client/websockets/protocol.py", line 200, in _authenticate
return await self.invoke_method("auth.login_with_api_key", [self._api_key])
File "/usr/local/lib/python3.10/site-packages/aiotruenas_client/websockets/protocol.py", line 92, in invoke_method
recv = await recv_future
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/truenas/__init__.py", line 64, in async_setup_entry
machine = await Machine.create(
File "/usr/local/lib/python3.10/site-packages/aiotruenas_client/websockets/machine.py", line 51, in create
await m.connect(
File "/usr/local/lib/python3.10/site-packages/aiotruenas_client/websockets/machine.py", line 92, in connect
await self._connect(auth_protocol, host, secure)
File "/usr/local/lib/python3.10/site-packages/aiotruenas_client/websockets/machine.py", line 199, in _connect
await connect(
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 654, in __await_impl_timeout__
async with asyncio_timeout(self.open_timeout):
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/async_timeout.py", line 169, in __aexit__
self._do_exit(exc_type)
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/async_timeout.py", line 252, in _do_exit
raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
2023-04-13 11:33:12.276 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 959, in transfer_data
message = await self.read_message()
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1029, in read_message
frame = await self.read_data_frame(max_size=self.max_size)
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1104, in read_data_frame
frame = await self.read_frame(max_size)
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1161, in read_frame
frame = await Frame.read(
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/framing.py", line 68, in read
data = await reader(2)
File "/usr/local/lib/python3.10/asyncio/streams.py", line 707, in readexactly
await self._wait_for_data('readexactly')
File "/usr/local/lib/python3.10/asyncio/streams.py", line 501, in _wait_for_data
await self._waiter
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiotruenas_client/websockets/protocol.py", line 166, in _websocket_message_handler
async for message in self:
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 497, in __aiter__
yield await self.recv()
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 568, in recv
await self.ensure_open()
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 930, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: no close frame received or sent