alexmohr / media_player.sony

Custom component for Home Assistant to control Sony devices
Apache License 2.0
16 stars 8 forks source link

Failed to register #34

Open bithajcsar opened 2 years ago

bithajcsar commented 2 years ago

I get the error message after entering the 0000 PIN code. Nothing happens on the Blu-ray device screen. Message in the log: 2022-01-25 10:31:44 ERROR (SyncWorker_2) [sonyapilib.device] HTTPError: 404 Client Error: Not Found for url: http://172.16.1.170:10000/sony/accessControl 2022-01-25 10:31:44 ERROR (SyncWorker_2) [custom_components.sony.media_player] An unknown error occured during registration

My device is Sony BDP-S6700 NMap scan:

NSE: Script Pre-scanning. Initiating NSE at 10:48 Completed NSE at 10:48, 0.00s elapsed Initiating NSE at 10:48 Completed NSE at 10:48, 0.00s elapsed Initiating NSE at 10:48 Completed NSE at 10:48, 0.00s elapsed Initiating ARP Ping Scan at 10:48 Scanning 172.16.1.170 [1 port] Completed ARP Ping Scan at 10:48, 0.15s elapsed (1 total hosts) Initiating Parallel DNS resolution of 1 host. at 10:48 Completed Parallel DNS resolution of 1 host. at 10:48, 0.01s elapsed Scanning 172.16.1.170 [65535 ports] Discovered open port 50201/tcp on 172.16.1.170 Discovered open port 52323/tcp on 172.16.1.170 Discovered open port 60151/tcp on 172.16.1.170 Discovered open port 50202/tcp on 172.16.1.170 Discovered open port 50002/tcp on 172.16.1.170 Discovered open port 50001/tcp on 172.16.1.170 Discovered open port 64321/tcp on 172.16.1.170 Discovered open port 9080/tcp on 172.16.1.170 Discovered open port 10000/tcp on 172.16.1.170 Discovered open port 54400/tcp on 172.16.1.170 Discovered open port 9090/tcp on 172.16.1.170 Completed SYN Stealth Scan at 10:48, 6.28s elapsed (65535 total ports) Initiating Service scan at 10:48 Scanning 11 services on 172.16.1.170 Completed Service scan at 10:48, 30.14s elapsed (11 services on 1 host) Initiating OS detection (try #1) against 172.16.1.170 Retrying OS detection (try #2) against 172.16.1.170 Retrying OS detection (try #3) against 172.16.1.170 Retrying OS detection (try #4) against 172.16.1.170 Retrying OS detection (try #5) against 172.16.1.170 NSE: Script scanning 172.16.1.170. Initiating NSE at 10:49 Completed NSE at 10:49, 30.56s elapsed Initiating NSE at 10:49 Completed NSE at 10:49, 2.10s elapsed Initiating NSE at 10:49 Completed NSE at 10:49, 0.01s elapsed Nmap scan report for 172.16.1.170 Host is up (0.0013s latency). Not shown: 65524 closed tcp ports (reset) PORT STATE SERVICE VERSION 9080/tcp open http Mongoose httpd 9090/tcp open http lighttpd 1.4.35 |http-title: Site doesn't have a title (text/html; charset=utf-8). | http-methods: | Supported Methods: OPTIONS GET HEAD POST 10000/tcp open snet-sensor-mgmt? | fingerprint-strings: | FourOhFourRequest, GetRequest, HTTPOptions: | HTTP/1.1 404 Not Found | Connection: close | Content-Length: 27 | Content-Type: application/json | {"error":[404,"Not Found"]} 50001/tcp open upnp | fingerprint-strings: | FourOhFourRequest: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:44 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | GetRequest: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:34 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | HTTPOptions, RTSPRequest: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:34 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | SIPOptions: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:44 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 50002/tcp open http Sony BDP-BX58 TV http config 2.0 | http-methods: |_ Supported Methods: GET POST OPTIONS |_http-title: Site doesn't have a title. 50201/tcp open http Sony BDP-BX58 TV http config 2.0 |http-title: Site doesn't have a title. | http-methods: | Supported Methods: GET OPTIONS 50202/tcp open http Sony BDP-BX58 TV http config 2.0 |http-title: Site doesn't have a title. 52323/tcp open upnp | fingerprint-strings: | FourOhFourRequest: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:39 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | X-AV-Server-Info.sony.com: av=5.0; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; | GetRequest: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | X-AV-Server-Info.sony.com: av=5.0; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; | HTTPOptions: | HTTP/1.1 403 Forbidden | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | X-AV-Server-Info.sony.com: av=5.0; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; | RTSPRequest: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | X-AV-Server-Info.sony.com: av=5.0; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; | SIPOptions: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:39 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDP/2.0 | X-AV-Server-Info.sony.com: av=5.0; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; 54400/tcp open http Sony BDP-S6700 http media client (av=5.0; mv=2.0) |http-title: Site doesn't have a title. 60151/tcp open upnp | fingerprint-strings: | FourOhFourRequest: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:39 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; | GetRequest, HTTPOptions: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; | RTSPRequest: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; | SIPOptions: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:39 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; 64321/tcp open upnp | fingerprint-strings: | FourOhFourRequest: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:39 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; | GetRequest: | HTTP/1.1 404 Not Found | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; | HTTPOptions: | HTTP/1.1 403 Forbidden | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; | RTSPRequest: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:29 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; | X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=; | SIPOptions: | HTTP/1.1 400 Bad Request | Connection: close | Date: Tue, 25 Jan 2022 09:48:39 GMT | Server: Linux/3.10 UPnP/1.0 Sony-BDV/2.0 | X-AV-Server-Info.sony.com: av=5.0; hn=""; cn="Sony Corporation"; mn="BDP-S6700"; mv="2.0"; |_ X-AV-Physical-Unit-Info.sony.com: pa="BDP-S6700"; pl=;

alexmohr commented 2 years ago

Install a packet tracing app on your device and trace the registration process of an official sony app and post this here in pcap format. The registration process seems to be different for your device.

bithajcsar commented 2 years ago

I installed the Sony remote control application on my Win10 and successfully registered with the BDP-S6700. Wireshark's capture attached BDP-S6700_authentication.zip .

alexmohr commented 2 years ago

Thanks for providing the trace. It looks like the registration URL is different for your API version (register instead of accessControl). It must be fixed in the api library https://github.com/alexmohr/sonyapilib/tree/master/sonyapilib I probably won't get around to do this any time soon. You can try to replace https://github.com/alexmohr/sonyapilib/blob/master/sonyapilib/device.py#L395 with "register" but I'm afraid that's not the only change.

bithajcsar commented 2 years ago

Could you give me a hint how could I change that line right on my PasPi (Home Assistant OS)?

alexmohr commented 2 years ago

You have to edit the python file of the api lib. Login via ssh and run find / -name "*sonyaplib*" you should find a directory under which a file named device.py can be found. Edit this in the way described above