cth35 / tydom_python

Example of Python Code to manage Tydom (Delta Dore) devices - Need Tydom Gateway
Apache License 2.0
31 stars 5 forks source link

server rejected WebSocket connection: HTTP 401 #9

Closed Sn0wFox closed 4 years ago

Sn0wFox commented 4 years ago

Hey there, thanks a lot for your work.

Unfortunately, I keep getting a 401 when opening the websocket to mediation.tydom.com. I'm sure the password and mac address are correct (for the password, it's supposed to be the same you use to log in the mobile app, right ?). The authorization header also looks correct so I don't understand.

I also tried to connect locally, but then I receive a multi-lines header and the script crashes because the websockets library doesn't support that. I therefore quickly ported the code to nodejs to see how it goes, but unfortunately I receive a 401 as well when opening the websocket.

I have a Tydom box 1.0 and trying under Windows, python 3.8.2.

Do you know if the script still works or do you have any hint to point me in the right direction ? :/

If I can help you by providing any additional information, I'll be glad to do so :)

cth35 commented 4 years ago

Hello,I've run the script and it still works (localy and also via mediation).Check the mac adress. It should be 12 digit chars (in the app is only the last 6 digits)Regards Ced Le vendredi 10 avril 2020 à 22:21:05 UTC+2, Ruben Péricas-Moya notifications@github.com a écrit :

Hey there, thanks a lot for your work.

Unfortunately, I keep getting a 401 when opening the websocket to mediation.tydom.com. I'm sure the password and mac address are correct (for the password, it's supposed to be the same you use to log in the mobile app, right ?). The authorization header also looks correct so I don't understand.

I also tried to connect locally, but then I receive a multi-lines header and the script crashes because the websockets library doesn't support that. I therefore quickly ported the code to nodejs to see how it goes, but unfortunately I receive a 401 as well when opening the websocket.

I have a Tydom box 1.0 and trying under Windows, python 3.8.2.

Do you know if the script still works or do you have any hint to point me in the right direction ? :/

If I can help you by providing any additional information, I'll be glad to do so :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Sn0wFox commented 4 years ago

Wow ok I figured that out, it's quite dumb.

My password was generated by a password manager automatically with more than 20 characters. Yet, the app doesn't allow more than 15 characters. So when my password manager was autofilling the password field in the app, the field was truncated to 15 characters and I was able to login correctly.

Yet in the script, I put the whole password, which therefore wasn't correct. Hence the 401. The app never showed any warning so I never noticed.

... that's it.

Sorry for bothering, and again thanks for your work, it now works like a charm :)