Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apparently missing some dependency, bunch of errors #126

Closed
skorpioskorpio opened this issue Jan 25, 2023 · 11 comments
Closed

Apparently missing some dependency, bunch of errors #126

skorpioskorpio opened this issue Jan 25, 2023 · 11 comments

Comments

@skorpioskorpio
Copy link

So ran the pip install bit all seemed to go without a hitch. Running songpal with no args gives the expected Usage: info, however anything beyond that fails. Example:

      ➜  ~ songpal discover
      Discovering for 5 seconds
      INFO:songpal.discovery:Discovering for 5 seconds
      Traceback (most recent call last):
        File "/usr/bin/songpal", line 8, in <module>
          sys.exit(cli())
        File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
          return self.main(*args, **kwargs)
        File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
          rv = self.invoke(ctx)
        File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
          return _process_result(sub_ctx.command.invoke(sub_ctx))
        File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
          return ctx.invoke(self.callback, **ctx.params)
        File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
          return __callback(*args, **kwargs)
        File "/usr/lib/python3.10/site-packages/songpal/main.py", line 48, in wrapper
          return loop.run_until_complete(f(*args, **kwargs))
        File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
          return future.result()
        File "/usr/lib/python3.10/asyncio/coroutines.py", line 136, in coro
          res = yield from await_meth()
        File "/usr/lib/python3.10/site-packages/songpal/main.py", line 206, in discover
          await Discover.discover(TIMEOUT, ctx.obj["debug"] or 0, callback=print_discovered)
        File "/usr/lib/python3.10/site-packages/songpal/discovery.py", line 78, in discover
          await async_search(
      TypeError: async_search() got an unexpected keyword argument 'service_type'

This is on a relatively clean, recent HAOS installation. Looks like I am missing a library or something, are there dependencies for this to work?

@skorpioskorpio
Copy link
Author

skorpioskorpio commented Jan 25, 2023

Oh and this is the output from pip list:

      Package            Version
      ------------------ -------
      aiohttp            3.8.3
      aiosignal          1.3.1
      async-timeout      4.0.2
      async-upnp-client  0.33.0
      attrs              22.2.0
      awake              1.0
      charset-normalizer 2.1.1
      click              8.1.3
      defusedxml         0.7.1
      frozenlist         1.3.3
      idna               3.4
      importlib-metadata 6.0.0
      multidict          6.0.4
      packaging          21.3
      pathspec           0.10.3
      pip                22.3.1
      pulsemixer         1.5.1
      pyparsing          3.0.9
      python-didl-lite   1.3.2
      python-songpal     0.15.1
      PyYAML             6.0
      retrying           1.3.3
      setuptools         65.6.0
      six                1.16.0
      voluptuous         0.13.1
      yamllint           1.29.0
      yarl               1.8.2
      zipp               3.11.0

@rytilahti
Copy link
Owner

Could you try if the git master branch works? #121 is the one that should fix this, if that works, I'll prepare a new release asap.

@skorpioskorpio
Copy link
Author

I don't know, I think so. I did do a git init so there is ~.git/. I am not by any means a git expert. This code is the first I ever used pip for to be honest, I've generally just cloned. But ya know everything in HAOS is, well the HAOS way of doing things.

@skorpioskorpio
Copy link
Author

Anyway, I'm not sure the receiver I am trying to get to work is going to work anyway, it's a Sony STR-ZA3100ES which is not on the support list, and doesn't show up as a uPNP device. It does however have a full web GUI to change just about any setting on it, including a virtual remote, so would obviously be controllable with a web scraper, but that's way beyond my skill level. My interest is in changing volume and inputs, I have so many easier devices everywhere to act as media servers that that functionality really doesn't buy me anything. The Pioneer and Sony STR-ZA810ESs I have work just fine in that regard, it's only the 3100, the most capable one, that doesn't work with HA.

@rytilahti
Copy link
Owner

Ah, it could very well be that it is using another protocol (if it's even controllable using some official app?), but here are instructions on how you can test the git version:

git clone https://github.com/rytilahti/python-songpal.git
cd python-songpal
poetry install
poetry shell  # optional, this activates the poetry-created virtualenv, you can also execute `poetry run songpal` instead
songpal --version

@skorpioskorpio
Copy link
Author

Apparently poetry is not installed by default, so I installed it. Ran the poetry install and it did stuff, ran songpal again (just checking) and did get the same errors, although running poetry run songpal diacover gave me this:

      python-songpal # poetry run songpal discover
      Discovering for 5 seconds
      INFO:songpal.discovery:Discovering for 5 seconds
      ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo
      ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo
      ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo
      ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo
      ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo
      ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo
      ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo

Which looks encouraging, maybe.

@rytilahti
Copy link
Owner

So the device is answer to the query, but the description file for the device does not contain this X_ScalarWebAPI_DeviceInfo element which should contain information on where the service is running.

You could try poetry run songpal -d discover to get some more output, it will display the contents where it tries to look for that device info object. See if there's X_ScalarWebAPI_BaseURL or something similar available, or just paste the file here if you want and I'll take a look if there's something useful.

If you can find the URL, you can try to define it manually using songpal --endpoint <url> and see if any of the commends work.

@d3xt3r2909
Copy link

d3xt3r2909 commented Mar 8, 2023

Output of poetry run songpal -d discover

songpal --version : songpal, version 0.15.1

poetry run songpal -d discover :

Setting debug level to 1
Discovering for 5 seconds
INFO:songpal.discovery:Discovering for 5 seconds
DEBUG:async_upnp_client.search:Start listening for search responses
DEBUG:async_upnp_client.ssdp:Creating socket, source: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('0.0.0.0', 0)), target: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('239.255.255.250', 1900))
DEBUG:async_upnp_client.ssdp:Connection made, transport: <_SelectorDatagramTransport fd=6 read=idle write=<idle, bufsize=0>>, socket: <asyncio.TransportSocket fd=6, family=2, type=2, proto=0, laddr=('0.0.0.0', 0)>
DEBUG:async_upnp_client.search:On connect, transport: <_SelectorDatagramTransport fd=6 read=polling write=<idle, bufsize=0>>, socket: <asyncio.TransportSocket fd=6, family=2, type=2, proto=0, laddr=('0.0.0.0', 0)>
DEBUG:async_upnp_client.search:Sending SEARCH packet, transport: <_SelectorDatagramTransport fd=6 read=polling write=<idle, bufsize=0>>, socket: <asyncio.TransportSocket fd=6, family=2, type=2, proto=0, laddr=('0.0.0.0', 0)>, override_target: None
DEBUG:async_upnp_client.ssdp:Sending SSDP packet, transport: <_SelectorDatagramTransport fd=6 read=polling write=<idle, bufsize=0>>, socket: <asyncio.TransportSocket fd=6, family=2, type=2, proto=0, laddr=('0.0.0.0', 0)>, target: ('239.255.255.250', 1900)
DEBUG:async_upnp_client.traffic.ssdp:Sending SSDP packet, target: ('239.255.255.250', 1900), data: b'M-SEARCH * HTTP/1.1\r\nHOST:239.255.255.250:1900\r\nMAN:"ssdp:discover"\r\nMX:5\r\nST:urn:schemas-sony-com:service:ScalarWebAPI:1\r\n\r\n'
DEBUG:async_upnp_client.traffic.ssdp:Received packet from ('192.168.1.181', 57564): b'HTTP/1.1 200 OK\r\nCACHE-CONTROL:max-age=1800\r\nDATE:Wed, 08 Mar 2023 09:45:11 GMT\r\nSERVER:async-upnp-client/0.33.1 UPnP/2.0 Server/1.0\r\nST:upnp:rootdevice\r\nUSN:UUID:FD4B0475-BB4D-499F-B8AF-46A548C7E10F::upnp:rootdevice\r\nEXT:\r\nLOCATION:http://192.168.1.181:40000/device.xml\r\nBOOTID.UPNP.ORG:1678265955\r\nCONFIGID.UPNP.ORG:1\r\n\r\n'
DEBUG:async_upnp_client.search:Received search response, _remote_addr: ('192.168.1.181', 57564), USN: UUID:FD4B0475-BB4D-499F-B8AF-46A548C7E10F::upnp:rootdevice, location: http://192.168.1.181:40000/device.xml
DEBUG:async_upnp_client.client_factory:Creating device, description_url: http://192.168.1.181:40000/device.xml
DEBUG:async_upnp_client.traffic.upnp:Sending request:
GET http://192.168.1.181:40000/device.xml



DEBUG:async_upnp_client.traffic.upnp:Got response from GET http://192.168.1.181:40000/device.xml:
200
Content-Type: text/xml; charset=utf-8
Content-Length: 1449
Date: Wed, 08 Mar 2023 09:45:11 GMT
Server: Python/3.10 aiohttp/3.8.4

b'<root xmlns="urn:schemas-upnp-org:device-1-0"><specVersion><major>1</major><minor>0</minor></specVersion><device xmlns="urn:schemas-upnp-org:device-1-0"><deviceType>urn:home-assistant.io:device:HomeAssistant:1</deviceType><friendlyName>Home (Home Assistant)</friendlyName><manufacturer>Home Assistant</manufacturer><manufacturerURL>https://www.home-assistant.io</manufacturerURL><modelDescription /><modelName>Home Assistant Container</modelName><modelNumber>2023.3.1</modelNumber><modelURL>https://www.home-assistant.io</modelURL><serialNumber>fd4b0475bb4d499fb8af46a548c7e10f</serialNumber><UDN>UUID:FD4B0475-BB4D-499F-B8AF-46A548C7E10F</UDN><UPC /><presentationURL>http://192.168.1.181:8123</presentationURL><iconList><icon><mimetype>image/png</mimetype><width>1024</width><height>1024</height><depth>24</depth><url>http://192.168.1.181:8123/static/icons/favicon-1024x1024.png</url></icon><icon><mimetype>image/png</mimetype><width>512</width><height>512</height><depth>24</depth><url>http://192.168.1.181:8123/static/icons/favicon-512x512.png</url></icon><icon><mimetype>image/png</mimetype><width>384</width><height>384</height><depth>24</depth><url>http://192.168.1.181:8123/static/icons/favicon-384x384.png</url></icon><icon><mimetype>image/png</mimetype><width>192</width><height>192</height><depth>24</depth><url>http://192.168.1.181:8123/static/icons/favicon-192x192.png</url></icon></iconList><serviceList /><deviceList /></device></root>'
<ns0:device xmlns:ns0="urn:schemas-upnp-org:device-1-0"><ns0:deviceType>urn:home-assistant.io:device:HomeAssistant:1</ns0:deviceType><ns0:friendlyName>Home (Home Assistant)</ns0:friendlyName><ns0:manufacturer>Home Assistant</ns0:manufacturer><ns0:manufacturerURL>https://www.home-assistant.io</ns0:manufacturerURL><ns0:modelDescription /><ns0:modelName>Home Assistant Container</ns0:modelName><ns0:modelNumber>2023.3.1</ns0:modelNumber><ns0:modelURL>https://www.home-assistant.io</ns0:modelURL><ns0:serialNumber>fd4b0475bb4d499fb8af46a548c7e10f</ns0:serialNumber><ns0:UDN>UUID:FD4B0475-BB4D-499F-B8AF-46A548C7E10F</ns0:UDN><ns0:UPC /><ns0:presentationURL>http://192.168.1.181:8123</ns0:presentationURL><ns0:iconList><ns0:icon><ns0:mimetype>image/png</ns0:mimetype><ns0:width>1024</ns0:width><ns0:height>1024</ns0:height><ns0:depth>24</ns0:depth><ns0:url>http://192.168.1.181:8123/static/icons/favicon-1024x1024.png</ns0:url></ns0:icon><ns0:icon><ns0:mimetype>image/png</ns0:mimetype><ns0:width>512</ns0:width><ns0:height>512</ns0:height><ns0:depth>24</ns0:depth><ns0:url>http://192.168.1.181:8123/static/icons/favicon-512x512.png</ns0:url></ns0:icon><ns0:icon><ns0:mimetype>image/png</ns0:mimetype><ns0:width>384</ns0:width><ns0:height>384</ns0:height><ns0:depth>24</ns0:depth><ns0:url>http://192.168.1.181:8123/static/icons/favicon-384x384.png</ns0:url></ns0:icon><ns0:icon><ns0:mimetype>image/png</ns0:mimetype><ns0:width>192</ns0:width><ns0:height>192</ns0:height><ns0:depth>24</ns0:depth><ns0:url>http://192.168.1.181:8123/static/icons/favicon-192x192.png</ns0:url></ns0:icon></ns0:iconList><ns0:serviceList /><ns0:deviceList /></ns0:device>
ERROR:songpal.discovery:Unable to find X_ScalaerWebAPI_DeviceInfo
DEBUG:async_upnp_client.ssdp:Lost connection, error: None, transport: <_SelectorDatagramTransport closing fd=6 read=idle write=<idle, bufsize=0>>```

@rytilahti
Copy link
Owner

Here's the XML in a more readable format:

<?xml version="1.0" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
        <specVersion>
                <major>1</major>
                <minor>0</minor>
        </specVersion>
        <device xmlns="urn:schemas-upnp-org:device-1-0">
                <deviceType>urn:home-assistant.io:device:HomeAssistant:1</deviceType>
                <friendlyName>Home (Home Assistant)</friendlyName>
                <manufacturer>Home Assistant</manufacturer>
                <manufacturerURL>https://www.home-assistant.io</manufacturerURL>
                <modelDescription/>
                <modelName>Home Assistant Container</modelName>
                <modelNumber>2023.3.1</modelNumber>
                <modelURL>https://www.home-assistant.io</modelURL>
                <serialNumber>fd4b0475bb4d499fb8af46a548c7e10f</serialNumber>
                <UDN>UUID:FD4B0475-BB4D-499F-B8AF-46A548C7E10F</UDN>
                <UPC/>
                <presentationURL>http://192.168.1.181:8123</presentationURL>
                <iconList>
                        <icon>
                                <mimetype>image/png</mimetype>
                                <width>1024</width>
                                <height>1024</height>
                                <depth>24</depth>
                                <url>http://192.168.1.181:8123/static/icons/favicon-1024x1024.png</url>
                        </icon>
                        <icon>
                                <mimetype>image/png</mimetype>
                                <width>512</width>
                                <height>512</height>
                                <depth>24</depth>
                                <url>http://192.168.1.181:8123/static/icons/favicon-512x512.png</url>
                        </icon>
                        <icon>
                                <mimetype>image/png</mimetype>
                                <width>384</width>
                                <height>384</height>
                                <depth>24</depth>
                                <url>http://192.168.1.181:8123/static/icons/favicon-384x384.png</url>
                        </icon>
                        <icon>
                                <mimetype>image/png</mimetype>
                                <width>192</width>
                                <height>192</height>
                                <depth>24</depth>
                                <url>http://192.168.1.181:8123/static/icons/favicon-192x192.png</url>
                        </icon>
                </iconList>
                <serviceList/>
                <deviceList/>
        </device>
</root>

Which seems to be a device description file for homeassistant. Huh, I didn't even know they would advertise using UPnP...
The response for the discovery has this header SERVER:async-upnp-client/0.33.1 UPnP/2.0 Server/1.0, so this is definitely not coming from a sony device.

@d3xt3r2909 could you try accessing http://192.168.1.181:40000/device.xml manually to see if it's showing the same XML?

@d3xt3r2909
Copy link

Hey, I saw msg later, I downgrade my python and it works as charm

@rytilahti
Copy link
Owner

Closing as solved then, thanks!

rytilahti added a commit that referenced this issue Nov 7, 2023
This release brings support for versioned method calls which are required by newer hardware, like TA-AN1000, thanks to @allistermaguire!

[Full Changelog](release/0.15.2...0.16)

**Implemented enhancements:**

- Add defining source-address for discover [\#133](#133) (@rytilahti)
- Add support for versioned methods used by newer devices [\#132](#132) (@allistermaguire)

**Closed issues:**

- Support for TA-AN1000 [\#130](#130)
- Support for SRS-XB23?  [\#127](#127)
- Apparently missing some dependency, bunch of errors [\#126](#126)
- App doesn't work on latest python 3.11.1 [\#125](#125)
- can't find the device [\#116](#116)

**Merged pull requests:**

- Use ruff for linting and formatting [\#139](#139) (@rytilahti)
- Configure to use CI as trusted publisher [\#137](#137) (@rytilahti)
- Drop importlib\_metadata dependency [\#136](#136) (@rytilahti)
- Drop Python 3.7 support [\#135](#135) (@rytilahti)
- Add updated devinfo with version info for HT-XT3 [\#134](#134) (@rytilahti)
- Add devinfo for STR-AZ5000ES receiver [\#129](#129) (@ohmantics)
@rytilahti rytilahti mentioned this issue Nov 7, 2023
rytilahti added a commit that referenced this issue Nov 7, 2023
This release brings support for versioned method calls which are required by newer hardware, like TA-AN1000, thanks to @allistermaguire!

[Full Changelog](release/0.15.2...0.16)

**Implemented enhancements:**

- Add defining source-address for discover [\#133](#133) (@rytilahti)
- Add support for versioned methods used by newer devices [\#132](#132) (@allistermaguire)

**Closed issues:**

- Support for TA-AN1000 [\#130](#130)
- Support for SRS-XB23?  [\#127](#127)
- Apparently missing some dependency, bunch of errors [\#126](#126)
- App doesn't work on latest python 3.11.1 [\#125](#125)
- can't find the device [\#116](#116)

**Merged pull requests:**

- Use ruff for linting and formatting [\#139](#139) (@rytilahti)
- Configure to use CI as trusted publisher [\#137](#137) (@rytilahti)
- Drop importlib\_metadata dependency [\#136](#136) (@rytilahti)
- Drop Python 3.7 support [\#135](#135) (@rytilahti)
- Add updated devinfo with version info for HT-XT3 [\#134](#134) (@rytilahti)
- Add devinfo for STR-AZ5000ES receiver [\#129](#129) (@ohmantics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants