tydom2mqtt
tydom2mqtt copied to clipboard
addon crashes when LAN is down
@fmartinou avec la dernière version ça ne semble pas vraiment résolu; J'ai mon routeur qui reboot toutes les semaines, HA est connecté dessus, donc le lien réseau tombe.
Et l'addon se retrouve alors planté, je dois le redémarrer. Les logs donnent ça :
future: <Future finished exception=ConnectionClosedError(None, None, None)>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
2023-08-12 03:30:58,549 - asyncio - ERROR - Future exception was never retrieved
future: <Future finished exception=ConnectionClosedError(None, None, None)>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
2023-08-12 03:30:58,549 - asyncio - ERROR - Future exception was never retrieved
future: <Future finished exception=ConnectionClosedError(None, None, None)>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
2023-08-12 03:30:58,550 - asyncio - ERROR - Future exception was never retrieved
future: <Future finished exception=ConnectionClosedError(None, None, None)>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
2023-08-12 03:30:58,551 - asyncio - ERROR - Task exception was never retrieved
future: <Task finished name='Task-2' coro=<listen_tydom() done, defined at /app/main.py:41> exception=NameError("name 'websockets' is not defined")>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 959, in transfer_data
message = await self.read_message()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/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.11/site-packages/websockets/legacy/protocol.py", line 1104, in read_data_frame
frame = await self.read_frame(max_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1161, in read_frame
frame = await Frame.read(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/framing.py", line 68, in read
data = await reader(2)
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/streams.py", line 729, in readexactly
await self._wait_for_data('readexactly')
File "/usr/local/lib/python3.11/asyncio/streams.py", line 522, in _wait_for_data
await self._waiter
File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 970, in _read_ready__get_buffer
nbytes = self._sock.recv_into(buf)
^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/main.py", line 49, in listen_tydom
incoming_bytes_str = await tydom_client.connection.recv()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 568, in recv
await self.ensure_open()
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: no close frame received or sent
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/main.py", line 56, in listen_tydom
except websockets.ConnectionClosed as e:
^^^^^^^^^^
NameError: name 'websockets' is not defined
2023-08-13 17:45:47,271 - mqtt.MqttClient - INFO - set_positionCmd message received (topic=cover/tydom/1658669537_1658669537/set_positionCmd, message=UP)
2023-08-13 17:45:47,288 - sensors.Cover - INFO - 1658669537 positionCmd UP
2023-08-13 17:45:47,295 - asyncio - ERROR - Task exception was never retrieved
future: <Task finished name='Task-38374' coro=<MqttClient.on_message() done, defined at /app/mqtt/MqttClient.py:77> exception=ConnectionClosedError(None, None, None)>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 959, in transfer_data
message = await self.read_message()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/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.11/site-packages/websockets/legacy/protocol.py", line 1104, in read_data_frame
frame = await self.read_frame(max_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1161, in read_frame
frame = await Frame.read(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/framing.py", line 68, in read
data = await reader(2)
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/streams.py", line 729, in readexactly
await self._wait_for_data('readexactly')
File "/usr/local/lib/python3.11/asyncio/streams.py", line 522, in _wait_for_data
await self._waiter
File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 970, in _read_ready__get_buffer
nbytes = self._sock.recv_into(buf)
^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/mqtt/MqttClient.py", line 131, in on_message
await Cover.put_positionCmd(tydom_client=self.tydom, device_id=device_id, cover_id=endpoint_id,
File "/app/sensors/Cover.py", line 124, in put_positionCmd
await tydom_client.put_devices_data(device_id, cover_id, 'positionCmd', positionCmd)
File "/app/tydom/TydomClient.py", line 256, in put_devices_data
await self.connection.send(a_bytes)
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 635, in send
await self.ensure_open()
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: no close frame received or sent
J'imagine c'est que lié !
Originally posted by @fmiermont in https://github.com/fmartinou/tydom2mqtt/issues/104#issuecomment-1677059116
I seem to have the same error: addon crashes when network is down, but I've got a different log:
Oct 08 14:36:06 homeassistant addon_6b64d821_tydom2mqtt[467]: 2023-10-08 16:36:06,137 - asyncio - ERROR - Future exception was never retrieved
Oct 08 14:36:06 homeassistant addon_6b64d821_tydom2mqtt[467]: future: <Future finished exception=ConnectionClosedError(None, None, None)>
Oct 08 14:36:06 homeassistant addon_6b64d821_tydom2mqtt[467]: websockets.exceptions.ConnectionCLosedError: no close frame received or sent
...
10 000 more or so identical lines
...
Oct 08 14:36:15 homeassistant addon_6b64d821_tydom2mqtt[467]: 2023-10-08 16:36:06,137 - asyncio - ERROR - Future exception was never retrieved
Oct 08 14:36:15 homeassistant addon_6b64d821_tydom2mqtt[467]: future: <Future finished exception=ConnectionClosedError(None, None, None)>
Oct 08 14:36:15 homeassistant addon_6b64d821_tydom2mqtt[467]: websockets.exceptions.ConnectionCLosedError: no close frame received or sent
Then nothing more in the log, until I restart the addon.