alexmohr / media_player.sony

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

str-dn1050 failed to read action list. #33

Open gzawahra opened 2 years ago

gzawahra commented 2 years ago

hello ! thank you for your great work on integrating old sony devices into hass, i've been trying to connect my str-dn1050 to has only for it to fail when i submit pin first time, as in i click on configure it tells me to send 0000 as an example i click confirm and it says "Failed to call service configurator/configure. failed to read action list from device" and when i check the logs i get this: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/components/configurator/__init__.py", line 226, in async_handle_service_call await self.hass.async_add_job(callback, call.data.get(ATTR_FIELDS, {})) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/sony/media_player.py", line 159, in sony_configuration_callback authenticated = sony_device.send_authentication(pin) File "/usr/local/lib/python3.9/site-packages/sonyapilib/device.py", line 725, in send_authentication registration_action = self._get_action("register") File "/usr/local/lib/python3.9/site-packages/sonyapilib/device.py", line 616, in _get_action raise ValueError('Failed to read action list from device.') ValueError: Failed to read action list from device.

is this a port problem ? is it because i don't have the correct ports set ? default app and dmr ports are not open on my str-dn1050 i have:

Port 80 (TCP) Port 1038 (TCP) Port 1900 (TCP) Port 8000 (TCP) Port 8080 (TCP) Port 10100 (TCP) Port 33335 (TCP) Port 41824 (TCP) Port 41893 (TCP) Port 50001 (TCP) Port 60151 (TCP)

any help would be apreciated, thanks !

alexmohr commented 2 years ago

The dmr port is necessary to get the list of available action. Unfortunately the API was only documented for sony partners so this is a lot of reverse engineering. Therefore I can't really tell you which port is which. Basically you have two options:

  1. Trial and error
  2. Get a packet sniffer app (i.e. https://play.google.com/store/apps/details?id=app.greyshirts.sslcapture&hl=en&gl=US) and trace the traffic of the sony app while you pair your device to the app. export the trace in pcap format and attach it here, so I can take a look
gzawahra commented 2 years ago

Thank you very much for your quick reply, I managed to find dmr port I think because I can get dmr.xml on port 41824 but I still get the same error, I'm not sure that ircc.xml exists on my device according to packet capture I think it should be cers/actionlist.xml here's a link to the four pcap files generated during registration, unfortunately I couldn't record discovery packets of network devices because search would fail in Sideview app when packet capture is active, even if I give the ip manually. Also I couldn't manually GET ircc.xml on any of the ports I don't know if I can't access it directly or if it's because it doesn't exist. https://vos1.cloud/s/TZMBWxQLq73FdwA Thanks again for all your help!

alexmohr commented 2 years ago

Your packet trace does not how the registration is done as some parts in between are missing. The API of your device is not compatible with the current implementation of the sonyapilib.

If you post a complete packet trace for the registration process I might have a change to understand how it works. Unfortunately it's very hard to implement this w/o access to the device directly and therefore I probably won't be able to do it.