-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hi.
I've tried to use the "largotef" fork (without the MQTT part) of this program with :
-
Raspberry with latest Raspberry Pi OS with desktop
Release date: May 3rd 2023
System: 32-bit
Kernel version: 6.1
Debian version: 11 (bullseye) -
Tydom 1.0
I achieved to configure Tydom 1.0 password with an android Tydom APK V3 -
Python version is 3.9.6
My test is :
python main.py
The result is always 401 (Unauthorized) :
send: b'GET /mediation/client?mac={my_mac}&appli=1 HTTP/1.1\r\nAccept-Encoding: identity\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nHost: {my_ip}:443\r\nAccept: /\r\nSec-WebSocket-Key: {websocket_key}==\r\nSec-WebSocket-Version: 13\r\n\r\n'
reply: 'HTTP/1.1 401 Unauthorized\r\n'
header: Connection: close
etc...
I've seen on domotics forums (jeedom...) that people have now exactly the same result 401 (Unauthorized) using this program.
But if I use a simple HTML5 websocket code on Chrome (on the Raspberry or on a PC Windows), the websocket connection is working well (but the sending message is not working : disconnection just after) :
index.html :
<!DOCTYPE HTML>
<html>
<head>
<script type = "text/javascript">
function WebSocketTest() {
if ("WebSocket" in window) {
alert("WebSocket is supported by your Browser!");
// Open a web socket
var ws = new WebSocket("wss://{my_mac}:{my_pass}@IP:443/mediation/client?mac={my_mac}&appli=1");
ws.onopen = function() {
alert("WebSocket oppened");
// Web Socket is connected, send data using send()
ws.send("GET /info HTTP/1.1\r\nContent-Length: 0\r\nContent-Type: application/json; charset=UTF-8\r\nTransac-Id: 0\r\n\r\n");
alert("Message is sent...");
};
ws.onmessage = function (evt) {
var received_msg = evt.data;
alert("Message is received...");
};
ws.onclose = function() {
// websocket is closed.
alert("Connection is closed...");
};
} else { alert("WebSocket NOT supported by your Browser!"); }
}
</script>
</head>
<body>
<div id = "sse">
<a href = "javascript:WebSocketTest()">Run WebSocket</a>
</div>
</body>
</html>
So here are my 2 questions :
A. Do you think the 401 answer with your software is due to a new security protection with Debian 11 (bullseye) or python 3.9.6 ?
B. With my little index.html, do you know the right data format in ws.send(data) to send a simple tydom "GET /info" ?
Thanks !