tydom2mqtt
tydom2mqtt copied to clipboard
tydom2mqtt suddenly loses connection to tydom
Hello, Without any apparent reason, the container suddenly loses connection:
tydom2mqtt | 2025-03-04 20:15:46,249 - __main__ - ERROR - Websocket connection closed: no close frame received or sent
tydom2mqtt | 2025-03-04 20:15:46,267 - tydom.TydomClient - INFO - Disconnecting
tydom2mqtt | 2025-03-04 20:15:46,283 - tydom.TydomClient - INFO - Disconnected
tydom2mqtt | 2025-03-04 20:15:46,283 - tydom.TydomClient - INFO - Connecting to tydom
tydom2mqtt | 2025-03-04 20:15:55,650 - tydom.TydomClient - ERROR - Exception when trying to connect with websocket (no close frame received or sent)
tydom2mqtt | 2025-03-04 20:15:55,844 - asyncio - ERROR - Task exception was never retrieved
tydom2mqtt | future: <Task finished name='Task-2' coro=<listen_tydom() done, defined at /app/main.py:41> exception=SystemExit(1)>
tydom2mqtt | Traceback (most recent call last):
tydom2mqtt | File "/app/tydom/TydomClient.py", line 197, in connect
tydom2mqtt | self.connection = await websockets.connect(
tydom2mqtt | ^^^^^^^^^^^^^^^^^^^^^^^^^
tydom2mqtt | File "/usr/local/lib/python3.11/site-packages/websockets/asyncio/client.py", line 444, in __await_impl__
tydom2mqtt | await self.connection.handshake(*self.handshake_args)
tydom2mqtt | File "/usr/local/lib/python3.11/site-packages/websockets/asyncio/client.py", line 86, in handshake
tydom2mqtt | async with self.send_context(expected_state=CONNECTING):
tydom2mqtt | File "/usr/local/lib/python3.11/contextlib.py", line 210, in __aenter__
tydom2mqtt | return await anext(self.gen)
tydom2mqtt | ^^^^^^^^^^^^^^^^^^^^^
tydom2mqtt | File "/usr/local/lib/python3.11/site-packages/websockets/asyncio/connection.py", line 933, in send_context
tydom2mqtt | raise self.protocol.close_exc from original_exc
tydom2mqtt | websockets.exceptions.ConnectionClosedError: no close frame received or sent
tydom2mqtt |
tydom2mqtt |
tydom2mqtt | During handling of the above exception, another exception occurred:
tydom2mqtt |
tydom2mqtt |
tydom2mqtt | Traceback (most recent call last):
tydom2mqtt | File "/usr/local/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
tydom2mqtt | self._run_once()
tydom2mqtt | File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
tydom2mqtt | handle._run()
tydom2mqtt | File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
tydom2mqtt | self._context.run(self._callback, *self._args)
tydom2mqtt | File "/app/main.py", line 44, in listen_tydom
tydom2mqtt | await tydom_client.connect()
tydom2mqtt | File "/app/tydom/TydomClient.py", line 207, in connect
tydom2mqtt | sys.exit(1)
tydom2mqtt | SystemExit: 1
tydom2mqtt | 2025-03-04 20:15:55,865 - asyncio - ERROR - Task was destroyed but it is pending!
tydom2mqtt | task: <Task pending name='Task-4' coro=<MQTTProtocol._read_loop() running at /usr/local/lib/python3.11/site-packages/gmqtt/mqtt/protocol.py:211> wait_for=<Future pending cb=[Task.task_wakeup()]>>
tydom2mqtt | 2025-03-04 20:15:55,866 - asyncio - ERROR - Task was destroyed but it is pending!
tydom2mqtt | task: <Task pending name='Task-3' coro=<poll_device_tydom() running at /app/main.py:74> wait_for=<Future pending cb=[Task.task_wakeup()]>>
I need to restart the container manually, and it works fine. I don't get this error every day, but it happens quite often.
I use docker compose :
tydom2mqtt:
image: ghcr.io/tydom2mqtt/tydom2mqtt
container_name: tydom2mqtt
depends_on:
- mosquitto
environment:
- TYDOM_MAC=001AXXXXXX
- TYDOM_PASSWORD=XXXXXXX
- TYDOM_IP=192.168.1.34
- MQTT_HOST=mosquitto
- MQTT_USER=XXXXX
- MQTT_PASSWORD=XXXXX