mgcrea/node-tydom-client

[Tydom 1.0] Websocket fails to open

Closed this issue · 5 comments

Hello,

First of all, thank you for your work!

Yesterday evening, my Tydom 1.0 asked me for a firmware update, it is now in version 02.05.12.

After the update, I tried to use your client to see what I can do with it.

In the logs, I have the following error :

Connecting to hostname='192.168.2.87' with username='XXXXXXXXXXXX' ...
  tydom-client About to GET request with url='https://192.168.2.87/mediation/client?mac=XXXXXXXXXXXX&appli=1' +0ms
(node:67073) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
  tydom-client Attempting to open new socket for hostname='192.168.2.87' +0ms
(node:67073) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
  tydom-client Tydom socket error for hostname='192.168.2.87' +1s
  tydom-client Tydom socket closed for hostname='192.168.2.87' +1ms

...

Error: Unexpected server response: 401
    at ClientRequest.<anonymous> (/Users/ludop/projects/testtydom/node_modules/ws/lib/websocket.js:576:7)

It seems that the first HTTPS request returns a 401 response (as expected), but the websocket connection too, I don't know why.

If it is any help, here is the header of the first HTTPS response :

Digest username="XXXXXXXXXXXX", realm="Protected Area", nonce="0ab4739bd510249843a46ab73f84d846", uri="/mediation/client?mac=XXXXXXXXXXXX&appli=1", response="7102b8d00e0710ec7b5620c57f169d92", qop=auth, nc=00000001, cnonce="fd0389ed"

Thanks in advance 😉

Hard to tell what is wrong, it is probably expecting a different signature for the auth header.

What you quoted is actually the auth computed header of the websocket, the actual first response does look like this on a Tydom 2.0:

Digest  realm="Protected Area",  qop="auth",  nonce="19c97f375d09d9e4461847eb371ea8bc",  opaque="fda01315b53a40946afc70ab6053eda1"

Which can be logged in tydom.ts

Might be worth checking what is replied in your case.

Best option is to sniff (mitm) the trafic of the HTTPS request made by the mobile app, for iOS, have a look at:

I'll check it out, thank you

I did not understand that you had a Tydom 2.0.

I will tell you my findings 😊

I have Tydom 1.0 and can confirm that it's works after updating to 02.05.12.
Application software version: 3.10.0 (323)
Tydom software version: 02.05.12
Tydom hardware version: 00.00.01

Update: I use homebridge-tydom

I made a password reset of my Tydom 1.0, and now it works! I don't really know why, maybe the was because my password used to begin with a digit?

Thank you very much for your time.

I close the issue

I hope that in the future it will be compatible with Tyxia 4730, because I have 9 units. Anyway thanks a lot to the community