rytilahti / python-songpal

Python library for interfacing with Sony's Songpal devices
GNU General Public License v3.0
62 stars 24 forks source link

SRS-X7 doesnt work #86

Open techcubs opened 3 years ago

techcubs commented 3 years ago

i am trying to get this to work with my Sony SRS-X7. it is officially on the list and i have to connecgted via the lan cable. when i run a discover, i dont see any results. i have manually set the ip and run the endpoint status comand as well but it says:

connection was refuled

rytilahti commented 3 years ago

Are you connected to the same network where the device is? The discovery process uses SSDP (part of UPnP), so if the devices are in separate networks this does not work.

There is no way to manually set an IP address in this library, so I'm not sure what exactly did you do to get that connection refused error. The --endpoint option requires the full URI with the port (such as http://192.168.1.1:10000/sony on my late HTXT3), but other devices may use different ports and paths.

If you want to debug this, you could try wireshark (or tcpdump) to do a traffic capture to see if the device itself is advertising itself, and check the device description file (in location header) to locate the endpoint.

torsten-liermann commented 6 months ago

I would like to integrate an SRS-X7 into my Home Assistant, but python-songpal can't find an endpoint. I used Intel's upnp tools for help and got this information:

Received 29.12.2023 at 12:05:37 (575)

NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age=1800
CONTENT-LENGTH: 0
LOCATION: http://192.168.100.105:8080/description.xml
X-AV-Server-Info: av="5.0"; cn="Sony Corporation"; mn="SRS-X7"; mv="1.00"
X-AV-Physical-Unit-Info: pa="SRS-X7"
NT: upnp:rootdevice
NTS: ssdp:byebye
USN: uuid:5f9ec1b3-ed59-1900-4530-fcf152b5eeb6::upnp:rootdevice

in "http://192.168.100.105:8080/description.xml" the following can be read:

<?xml version="1.0"?>
<root
  xmlns="urn:schemas-upnp-org:device-1-0"
  xmlns:pnpx="http://schemas.microsoft.com/windows/pnpx/2005/11"
  xmlns:df="http://schemas.microsoft.com/windows/2008/09/devicefoundation">
        <specVersion>
                <major>1</major>
                <minor>0</minor>
        </specVersion>
        <device>
                <dlna:X_DLNACAP xmlns:dlna="urn:schemas-dlna-org:device-1-0">playcontainer-0-1</dlna:X_DLNACAP>
                <av:X_StandardDMR xmlns:av="urn:schemas-sony-com:av">1.1</av:X_StandardDMR>
                <dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMR-1.50</dlna:X_DLNADOC>
                <pnpx:X_compatibleId>MS_DigitalMediaDeviceClass_DMR_V001</pnpx:X_compatibleId>
                <pnpx:X_deviceCategory>MediaDevices</pnpx:X_deviceCategory>
                <pnpx:X_hardwareId>VEN_0106&amp;DEV_0500&amp;SUBSYS_002&amp;REV_01</pnpx:X_hardwareId>
                <df:X_deviceCategory>Multimedia.DMR</df:X_deviceCategory>
                <av:X_Tandem_Deviceinfo xmlns:av="urn:schemas-sony-com:av"><av:X_Tandem_Version>3.0</av:X_Tandem_Version></av:X_Tandem_Deviceinfo>
                <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
                <friendlyName>Sony Speaker</friendlyName>
                <manufacturer>Sony Corporation</manufacturer>
                <manufacturerURL>http://www.sony.net/</manufacturerURL>
                <modelDescription>PERSONAL AUDIO SYSTEM</modelDescription>
                <modelName>SRS-X7</modelName>
                <modelNumber>JB3.2</modelNumber>
                <UDN>uuid:5f9ec1b3-ed59-1900-4530-fcf152b5eeb6</UDN>
                <iconList>
                        <icon>
                                <mimetype>image/jpeg</mimetype>
                                <width>48</width>
                                <height>48</height>
                                <depth>24</depth>
                                <url>/device_icon_48.jpg</url>
                        </icon>
                        <icon>
                                <mimetype>image/jpeg</mimetype>
                                <width>120</width>
                                <height>120</height>
                                <depth>24</depth>
                                <url>/device_icon_120.jpg</url>
                        </icon>
                        <icon>
                                <mimetype>image/png</mimetype>
                                <width>48</width>
                                <height>48</height>
                                <depth>24</depth>
                                <url>/device_icon_48.png</url>
                        </icon>
                        <icon>
                                <mimetype>image/png</mimetype>
                                <width>120</width>
                                <height>120</height>
                                <depth>24</depth>
                                <url>/device_icon_120.png</url>
                        </icon>
                </iconList>
                <serviceList>
                        <service>
                                <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
                                <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
                                <SCPDURL>/RenderingControl/desc.xml</SCPDURL>
                                <controlURL>/RenderingControl/ctrl</controlURL>
                                <eventSubURL>/RenderingControl/evt</eventSubURL>
                        </service>
                        <service>
                                <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
                                <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
                                <SCPDURL>/ConnectionManager/desc.xml</SCPDURL>
                                <controlURL>/ConnectionManager/ctrl</controlURL>
                                <eventSubURL>/ConnectionManager/evt</eventSubURL>
                        </service>
                        <service>
                                <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
                                <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
                                <SCPDURL>/AVTransport/desc.xml</SCPDURL>
                                <controlURL>/AVTransport/ctrl</controlURL>
                                <eventSubURL>/AVTransport/evt</eventSubURL>
                        </service>
                        <service>
                                <serviceType>urn:schemas-sony-com:service:X_Tandem:1</serviceType>
                                <serviceId>urn:schemas-sony-com:serviceId:X_Tandem</serviceId>
                                <SCPDURL>/TANDEMSCPD.xml</SCPDURL>
                                <controlURL>/upnp/control/TANDEM</controlURL>
                                <eventSubURL></eventSubURL>
                        </service>
                </serviceList>
                <presentationURL>http://192.168.100.105</presentationURL>
        </device>
</root>

So what should I specify as the endpoint for the HA integration?

Thanks for hints! Regards, Torsten

rytilahti commented 6 months ago

Hi Torsten,

looks like that device description file does not advertise the urn:schemas-sony-com:service:ScalarWebAPI:1 service which is what this library uses for communications, so you are likely out of luck and this device cannot be controlled using the songpal integration :-(

You could try the cli tool to discover (songpal discover for discovery after installing the python-songpal package) or to control it directly by testing the default endpoint I mentioned above or some variant (http://192.168.100.105:8080/sony/ maybe to follow the same path pattern by passing --endpoint option.

torsten-liermann commented 6 months ago

Hi Teemu,

Unfortunately, there is no Sony endpoint:

curl -vv 192.168.100.105:8080/sony/
*   Trying 192.168.100.105:8080...
* Connected to 192.168.100.105 (192.168.100.105) port 8080
> GET /sony/ HTTP/1.1
> Host: 192.168.100.105:8080
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< X-AV-Server-Info: av="5.0"; cn="Sony Corporation"; mn="SRS-X7"; mv="1.00"
< X-AV-Physical-Unit-Info: pa="SRS-X7"
* no chunk, no close, no size. Assume close to signal end
<

Then it seems that the SongPal integration is unsuitable for this type of speaker. I’m new to HA, but it looks like there is no integration via UPnP.

rytilahti commented 6 months ago

There is a generic dlna dmr, which I think should allow some controls: https://www.home-assistant.io/integrations/dlna_dmr/

Hope that helps!

torsten-liermann commented 6 months ago

Thanks for the advice, the URL for that would be http://:8080/description.xml The volume can definitely be adjusted.