fmartinou / tydom2mqtt

Deltadore Tydom to MQTT Bridge
https://fmartinou.github.io/tydom2mqtt/
MIT License
86 stars 49 forks source link

Fail to connect to Tydom #181

Open hockjl opened 3 months ago

hockjl commented 3 months ago

Hi Everyone,

Could you help me, I do not understant where is my problem Below are my logs

Thanks in advancer for your help !

"mqtt_ssl": false, "mqtt_user": "mqtt", "thermostat_custom_presets": null, "tydom_alarm_home_zone": 1, "tydom_alarm_night_zone": 2, "tydom_alarm_pin": "16", "tydom_ip": "192.168.1.104", "tydom_mac": "xxxxxxx", "tydom_password": "X**X", "tydom_polling_interval": 300 } 2024-03-16 15:52:10,819 - The configuration is valid 2024-03-16 15:52:10,819 - tydom.TydomClient - DEBUG - Initializing TydomClient Class 2024-03-16 15:52:10,819 - tydom.TydomClient - INFO - Configure local mode (192.168.1.104) 2024-03-16 15:52:10,822 - asyncio - DEBUG - Using selector: EpollSelector 2024-03-16 15:52:10,823 - mqtt.MqttClient - INFO - Connecting to mqtt broker (host=192.168.1.49, port=1883, user=mqtt, ssl=False) 2024-03-16 15:52:10,824 - tydom.TydomClient - INFO - Connecting to tydom 2024-03-16 15:52:13,303 - tydom.TydomClient - DEBUG - Response headers 2024-03-16 15:52:13,303 - tydom.TydomClient - DEBUG - Connection: close WWW-Authenticate: Digest realm="Protected Area", qop="auth", nonce="fc8c35d6cca7b303b99372ff3ae7d76d", opaque="c2b24a9be4c91b8e5109a6e39ec735b4" Content-Type: text/html

2024-03-16 15:52:13,307 - tydom.TydomClient - DEBUG - Response code 2024-03-16 15:52:13,307 - tydom.TydomClient - DEBUG - 401 2024-03-16 15:52:13,307 - tydom.TydomClient - DEBUG - response 2024-03-16 15:52:13,308 - tydom.TydomClient - DEBUG - b'<!doctype html>\r\n\r\nError 401\r\n\r\n

Error 401

\r\n

Authorization required

\r\n\r\n\r\n' 2024-03-16 15:52:13,308 - tydom.TydomClient - DEBUG - Upgrading http connection to websocket.... 2024-03-16 15:52:13,308 - tydom.TydomClient - DEBUG - Attempting websocket connection with Tydom hub 2024-03-16 15:52:13,319 - gmqtt.mqtt.protocol - INFO - [CONNECTION MADE] 2024-03-16 15:52:13,320 - websockets.client - DEBUG - = connection is CONNECTING 2024-03-16 15:52:13,321 - gmqtt.client - DEBUG - [CMD 0x20] b'\x00\x00\x06"\x00\n!\x00\x14' 2024-03-16 15:52:13,321 - gmqtt.client - DEBUG - [CONNACK] flags: 0x0, result: 0x0 2024-03-16 15:52:13,321 - mqtt.MqttClient - DEBUG - Subscribing to topics (+/tydom/#) 2024-03-16 15:52:13,321 - gmqtt.mqtt.utils - DEBUG - NEW ID: 1 2024-03-16 15:52:13,321 - gmqtt.mqtt.package - INFO - [SEND SUB] 1 [b'homeassistant/status'] 2024-03-16 15:52:13,321 - gmqtt.mqtt.utils - DEBUG - NEW ID: 2 2024-03-16 15:52:13,321 - gmqtt.mqtt.package - INFO - [SEND SUB] 2 [b'+/tydom/#'] 2024-03-16 15:52:13,322 - gmqtt.client - DEBUG - [QoS query IS EMPTY] 2024-03-16 15:52:13,322 - mqtt.MqttClient - INFO - Connected to mqtt broker 2024-03-16 15:52:13,323 - gmqtt.client - DEBUG - [CMD 0x90] b'\x00\x01\x00\x00' 2024-03-16 15:52:13,323 - gmqtt.client - INFO - [SUBACK] 1 (0,) 2024-03-16 15:52:13,323 - gmqtt.mqtt.utils - DEBUG - FREE MID: 1 2024-03-16 15:52:13,363 - gmqtt.client - DEBUG - [CMD 0x90] b'\x00\x02\x00\x00' 2024-03-16 15:52:13,363 - gmqtt.client - INFO - [SUBACK] 2 (0,) 2024-03-16 15:52:13,364 - gmqtt.mqtt.utils - DEBUG - FREE MID: 2 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > GET /mediation/client?mac=001A25073B10&appli=1 HTTP/1.1 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > Host: 192.168.1.104 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > Upgrade: websocket 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > Connection: Upgrade 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > Sec-WebSocket-Key: Po0gl7Hk3kUxx23XUheljA== 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > Sec-WebSocket-Version: 13 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > Authorization: Digest username="001A25073B10", realm="protected area", nonce="fc8c35d6cca7b303b99372ff3ae7d76d", uri="/mediation/client?mac=001A25073B10&appli=1", response="f4cbffcffabec0c214a6ba55c6152d7a", qop="auth", nc=00000001, cnonce="7f2b9ac80477c6e3" 2024-03-16 15:52:15,826 - websockets.client - DEBUG - > User-Agent: Python/3.11 websockets/12.0 2024-03-16 15:52:15,837 - websockets.client - DEBUG - < HTTP/1.1 401 Unauthorized 2024-03-16 15:52:15,837 - websockets.client - DEBUG - < Connection: close 2024-03-16 15:52:15,837 - websockets.client - DEBUG - < WWW-Authenticate: Digest realm="Protected Area", qop="auth", nonce="712517506608b4dc9cfe4ff4da5c91d1", opaque="3e8166c6df0bc8e2729d84e9aeb1def3" 2024-03-16 15:52:15,837 - websockets.client - DEBUG - < Content-Type: text/html 2024-03-16 15:52:15,837 - websockets.client - DEBUG - ! failing connection with code 1006 2024-03-16 15:52:15,837 - websockets.client - DEBUG - x closing TCP connection 2024-03-16 15:52:15,839 - websockets.client - DEBUG - = connection is CLOSED 2024-03-16 15:52:15,839 - tydom.TydomClient - ERROR - Exception when trying to connect with websocket (server rejected WebSocket connection: HTTP 401) 2024-03-16 15:52:15,849 - asyncio - ERROR - Task exception was never retrieved future: <Task finished name='Task-2' coro=<listen_tydom() done, defined at /app/main.py:42> exception=SystemExit(1)> Traceback (most recent call last): File "/app/tydom/TydomClient.py", line 187, in connect self.connection = await websockets.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 647, in await_impl_timeout return await self.await_impl() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 654, in await_impl await protocol.handshake( File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 325, in handshake raise InvalidStatusCode(status_code, response_headers) websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 401

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.11/asyncio/base_events.py", line 607, in run_forever self._run_once() File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once handle._run() File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/app/main.py", line 46, in listen_tydom await tydom_client.connect() File "/app/tydom/TydomClient.py", line 198, in connect sys.exit(1) SystemExit: 1 2024-03-16 15:52:15,866 - asyncio - ERROR - Task was destroyed but it is pending! task: <Task pending name='Task-5' coro=<MQTTProtocol._read_loop() running at /usr/local/lib/python3.11/site-packages/gmqtt/mqtt/protocol.py:211> wait_for=> 2024-03-16 15:52:15,866 - asyncio - ERROR - Task was destroyed but it is pending! task: <Task pending name='Task-4' coro=<Client._resend_qos_messages() running at /usr/local/lib/python3.11/site-packages/gmqtt/client.py:181> wait_for=> 2024-03-16 15:52:15,866 - asyncio - ERROR - Task was destroyed but it is pending! task: <Task pending name='Task-6' coro=<WebSocketCommonProtocol.close_connection() running at /usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py:1337> wait_for=> 2024-03-16 15:52:15,867 - asyncio - ERROR - Task was destroyed but it is pending! task: <Task pending name='Task-3' coro=<poll_device_tydom() running at /app/main.py:76> wait_for=>