Yeesssss !
Enfin (depuis le temps que j'attends une compatibilité X3D)
J'ai investit lourdement (50€ sur le bon coin) et j'ai paramétré le tydom sur mon réseau.
partie simple, ça fonctionne.
Le reste, je suis une b*te, donc je vais détailler :
un mkdir pour faire un nid au bébé (c'est le max de mes capacités en linux)
git clone
https://github.com/cth35/tydom_python
(j'ai déja cherché ça 5mn)
suivi de
chmod +x main.py
et de la mise à jour des paramètres dans le fichier (j'en ai trouvé 4 : mac, login, password, et host)
puis une commande qui passe pas :
python -m pip install websockets requests
ben non, faut python3 ... à priori, il était deja installé sur mon PI, donc :
python3 -m pip install websockets requests
et ça passe.
Bon, comment on lance un script python ?
10 mn de recherche plus tard :
python3 -E main.py get_devices_meta
ça se lance, et sa semble se connecter (j'utilise l'IP ou mediation, même résultat) :
Code : Tout sélectionner
send: b'GET /mediation/client?mac=001A2501636A&appli=1 HTTP/1.1\r\nAccept-Encoding: identity\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nHost: mediation.tydom.com:443\r\nAccept: */*\r\nSec-WebSocket-Key: 3KuWmZhdyyhYKeWApQ6bvw==\r\nSec-WebSocket-Version: 13\r\n\r\n'
reply: 'HTTP/1.1 401 \r\n'
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 1; mode=block
header: Cache-Control: no-cache, no-store, max-age=0, must-revalidate
header: Pragma: no-cache
header: Expires: 0
header: X-Frame-Options: DENY
header: Set-Cookie: JSESSIONID=FDFA852D739E635C9E41F3F0718F629C;path=/;HttpOnly
header: WWW-Authenticate: Digest realm="ServiceMedia", qop="auth", nonce="MTU3NjUwMTY3MTQ0NDozZTI4OTQ1YzYzYjBhMWEzMTUxMzA3NGMxMmVlMDJmYg=="
header: Content-Length: 0
header: Date: Mon, 16 Dec 2019 13:02:50 GMT
DEBUG:websockets.protocol:client - state = CONNECTING
DEBUG:websockets.protocol:client - event = connection_made(<asyncio.sslproto._SSLProtocolTransport object at 0x758f06b0>)
DEBUG:websockets.client:client > GET /mediation/client?mac=001A2501636A&appli=1 HTTP/1.1
DEBUG:websockets.client:client > Headers([('Host', 'mediation.tydom.com'), ('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Key', 'aFXqInuIaCXaKwbR8mtRzw=='), ('Sec-WebSocket-Version', '13'), ('Sec-WebSocket-Extensions', 'permessage-deflate; client_max_window_bits'), ('Authorization', 'Digest username="001A2501636A", realm="ServiceMedia", nonce="MTU3NjUwMTY3MTQ0NDozZTI4OTQ1YzYzYjBhMWEzMTUxMzA3NGMxMmVlMDJmYg==", uri="/mediation/client?mac=001A2501636A&appli=1", response="f557e5fd5a2dd4e199b467cc50979142", qop="auth", nc=00000001, cnonce="6665460873b8a6cc"'), ('User-Agent', 'Python/3.7 websockets/8.1')])
DEBUG:websockets.protocol:client - event = data_received(<474 bytes>)
DEBUG:websockets.client:client < HTTP/1.1 101
DEBUG:websockets.client:client < Headers([('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate'), ('Pragma', 'no-cache'), ('Expires', '0'), ('X-Frame-Options', 'DENY'), ('Set-Cookie', 'JSESSIONID=18B000F62AD6E670E487203FC60864AA;path=/;HttpOnly'), ('Upgrade', 'websocket'), ('Connection', 'upgrade'), ('Sec-WebSocket-Accept', 'Q01HVrZChRZpFvGIHf3SUbvi5K0='), ('Sec-WebSocket-Extensions', 'permessage-deflate;client_max_window_bits=15'), ('Date', 'Mon, 16 Dec 2019 13:02:51 GMT')])
DEBUG:websockets.protocol:client - state = OPEN
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=2, data=b'\x02GET /scenarios/file HTTP/1.1\r\nContent-Length: 0\r\nContent-Type: application/json; charset=UTF-8\r\nTransac-Id: 0\r\n\r\n', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - event = data_received(<4 bytes>)
DEBUG:websockets.protocol:client - event = data_received(<239 bytes>)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=2, data=b'\x02HTTP/1.1 404 Not Found\r\nServer: Tydom-001A2501636A\r\nUri-Origin: /scenarios/file\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nTransac-Id: 0\r\n\r\n9C\r\n<!doctype html>\r\n<html>\r\n<head><title>Error 404</title></head>\r\n<body>\r\n<h2>Error 404</h2>\r\n<p>The requested page could not be found</p>\r\n</body>\r\n</html>\r\n\r\n0\r\n\r\n', rsv1=False, rsv2=False, rsv3=False)
Cannot parse response
Expecting value: line 1 column 1 (char 0)
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=2, data=b'\x02PUT /scenarios/15 HTTP/1.1\r\nContent-Length: 0\r\nContent-Type: application/json; charset=UTF-8\r\nTransac-Id: 0\r\n\r\n\r\n\r\n', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - event = data_received(<34 bytes>)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=2, data=b'\x02HTTP/1.1 200 OK\r\nServer: Tydom-001A2501636A\r\nUri-Origin: /scenarios/15\r\nContent-Type: application/json\r\nContent-Length: 0\r\nTransac-Id: 0\r\n\r\n', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - state = CLOSING
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=8, data=b'\x03\xe8', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - event = data_received(<2 bytes>)
DEBUG:websockets.protocol:client - event = data_received(<2 bytes>)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=8, data=b'\x03\xe8', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - event = eof_received()
DEBUG:websockets.protocol:client - event = connection_lost(None)
DEBUG:websockets.protocol:client - state = CLOSED
DEBUG:websockets.protocol:client x code = 1000, reason = [no reason]
DEBUG:websockets.protocol:client x closing TCP connection
bref, ça à l'air de se connecter, mais je vois des 404, et je ne vois pas de données exploitables.
:-/
je vais faire des tests, mais un peu d'aide serait la bienvenue!