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

Not working with RX-V6A/TSR-700 receiver #67

Open
borski opened this issue Dec 10, 2020 · 23 comments
Open

Not working with RX-V6A/TSR-700 receiver #67

borski opened this issue Dec 10, 2020 · 23 comments
Assignees

Comments

@borski
Copy link

borski commented Dec 10, 2020

Hi! For some reason, rxv doesn't seem to work with the RX-V6A receiver. Is this a known issue?

@wuub wuub self-assigned this Jan 19, 2021
@wuub
Copy link
Owner

wuub commented Jan 19, 2021

@borski
Copy link
Author

borski commented Jan 19, 2021

Yes, works without an issue using the Yamaha app

@wuub
Copy link
Owner

wuub commented Jan 19, 2021

I assume you've tried to set it up in Home Assistant.

Can you try:

  1. Checking if discovery works
import rxv
rxv.ssdp.discover()
  1. Checking if manual control works
import rxv
r = http://192.168.1.xxx:80/YamahaRemoteControl/ctrl
r.basic_status

@borski
Copy link
Author

borski commented Jan 19, 2021

It does not, and visiting /YamahaRemoteControl/ctrl in a browser returns a 400 Bad Request :(

@borski
Copy link
Author

borski commented Jan 20, 2021

When I hit http://192.168.1.xxx:49154/MediaRenderer/desc.xml it spits out the following possibly relevant xml (snipped for relevancy)

<yamaha:X_device>
<yamaha:X_URLBase>http://192.168.1.xxx:80/</yamaha:X_URLBase>
<yamaha:X_serviceList>
<yamaha:X_service>
<yamaha:X_specType>urn:schemas-yamaha-com:service:X_YamahaRemoteControl:1</yamaha:X_specType>
<yamaha:X_controlURL>/YamahaRemoteControl/ctrl</yamaha:X_controlURL>
</yamaha:X_service>
<yamaha:X_service>
<yamaha:X_specType>urn:schemas-yamaha-com:service:X_YamahaExtendedControl:1</yamaha:X_specType>
<yamaha:X_yxcControlURL>/YamahaExtendedControl/v1/</yamaha:X_yxcControlURL>
<yamaha:X_yxcVersion>0945 </yamaha:X_yxcVersion>
</yamaha:X_service>
</yamaha:X_serviceList>
</yamaha:X_device>

and heading to http://192.168.1.xxx/YamahaExtendedControl/v1/ gets me a 200 with the following JSON response:

{"response_code":3}

No idea what this means or if it's helpful, but figured it might be?

@wuub
Copy link
Owner

wuub commented Jan 20, 2021

It looks like the receiver is using the same control mechanism and it will be possible to solve this.

Please try the 2nd way of manually instantiating rxv object, it should work (at least partially)

If so, we can then work on testing why SSDP discovery is broken

@borski
Copy link
Author

borski commented Jan 20, 2021

Oh, it does actually work! It didn't previously but it seems to be now!

>>> import rxv
>>> r = rxv.RXV("http://192.168.1.xxx:80/YamahaRemoteControl/ctrl", "RX-V6A")
>>> r.basic_status
BasicStatus(on='Standby', volume=-33.0, mute='Off', input='HDMI2')

SSDP discovery doesn't work:

>>> rxv.ssdp.discover()
[]

@wuub wuub added question and removed question labels Jan 20, 2021
@esev
Copy link
Contributor

esev commented Jan 22, 2021

I've also had issues with discovery. When there are multiple network interfaces the discovery packets seem to go out the first interface only. @borski do you have multiple network interfaces in the computer that you're testing on?

If that's the issue, it can be solved by sending discovery requests on each interface. Something like this:
https://github.com/pavoni/pywemo/blob/e375e12f4901461b02ceb08feb5c02a766c560ee/pywemo/ssdp.py#L299

@borski
Copy link
Author

borski commented Jan 22, 2021

Yes, but the raspi doesn't, unless I'm mistaken? aka Home Assistant should be able to do the discovery just fine.

@borski
Copy link
Author

borski commented Jan 22, 2021

@esev I made the change, locally, to force it try each interface; that isn't the issue. Good thought, though!

@wuub
Copy link
Owner

wuub commented Jan 22, 2021

Can you look if discovery is working

pip install --user ssdpy
ssdpy-discover -o 20 ssdp:all

and check if the IP of your receiver comes up.

@this-amazing-amy
Copy link

I have the same receiver and the same problems with discovery in HA. I tried discovery via ssdpy-discover and it showed up:

{'cache-control': 'max-age=1800',
 'content-length': '0',
 'ext': '',
 'location': 'http://192.168.1.101:49154/MediaRenderer/desc.xml',
 'server': 'Linux/3.2 UPnP/1.0 Network_Module/1.0 (RX-V6A)',
 'st': 'urn:schemas-upnp-org:service:RenderingControl:1',
 'usn': 'uuid:9ab0c000-f668-11de-9976-ccd42e2282a6::urn:schemas-upnp-org:service:RenderingControl:1'}

Don't know if that helps!

@esev
Copy link
Contributor

esev commented Jan 29, 2021

@PygmalionPolymorph could you try these three also?

ssdpy-discover -o 20 upnp:rootdevice
ssdpy-discover -o 20 urn:schemas-upnp-org:service:RenderingControl:1
ssdpy-discover -o 20 urn:schemas-upnp-org:device:MediaRenderer:1

upnp:rootdevice seems to be what is being used for the rxv library.

rxv/rxv/ssdp.py

Lines 21 to 27 in da90b75

SSDP_MSEARCH_QUERY = (
'M-SEARCH * HTTP/1.1\r\n'
'MX: 1\r\n'
'HOST: 239.255.255.250:1900\r\n'
'MAN: "ssdp:discover"\r\n'
'ST: upnp:rootdevice\r\n\r\n'
)

@esev
Copy link
Contributor

esev commented Jan 29, 2021

FWIW, my RX-V577 responds to upnp:rootdevice, urn:schemas-upnp-org:service:RenderingControl:1 and urn:schemas-upnp-org:device:MediaRenderer:1.

@this-amazing-amy
Copy link

{'cache-control': 'max-age=1800',
 'content-length': '0',
 'ext': '',
 'location': 'http://192.168.1.101:49154/MediaRenderer/desc.xml',
 'server': 'Linux/3.2 UPnP/1.0 Network_Module/1.0 (RX-V6A)',
 'st': 'upnp:rootdevice',
 'usn': 'uuid:9ab0c000-f668-11de-9976-ccd42e2282a6::upnp:rootdevice'}

{'cache-control': 'max-age=1800',
 'content-length': '0',
 'ext': '',
 'location': 'http://192.168.1.101:49154/MediaRenderer/desc.xml',
 'server': 'Linux/3.2 UPnP/1.0 Network_Module/1.0 (RX-V6A)',
 'st': 'urn:schemas-upnp-org:service:RenderingControl:1',
 'usn': 'uuid:9ab0c000-f668-11de-9976-ccd42e2282a6::urn:schemas-upnp-org:service:RenderingControl:1'}

{'cache-control': 'max-age=1800',
 'content-length': '0',
 'ext': '',
 'location': 'http://192.168.1.101:49154/MediaRenderer/desc.xml',
 'server': 'Linux/3.2 UPnP/1.0 Network_Module/1.0 (RX-V6A)',
 'st': 'urn:schemas-upnp-org:device:MediaRenderer:1',
 'usn': 'uuid:9ab0c000-f668-11de-9976-ccd42e2282a6::urn:schemas-upnp-org:device:MediaRenderer:1',
 'x-modelname': 'RX-V6A:CCD42E2282A6:Kino'}

I am getting responses for all 3 of those.

For completeness i tried to run discovery and manual control through rxv. Manual control worked:

>>> import rxv
>>> r = rxv.RXV("http://192.168.1.101:80/YamahaRemoteControl/ctrl", "RX-V6A")
>>> r.basic_status
BasicStatus(on='Standby', volume=-38.0, mute='Off', input='HDMI5')

But discovery didn't work, but unlike @borski i got an error:

>>> import rxv
>>> rxv.ssdp.discover()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/3.8/site-packages/rxv/ssdp.py", line 65, in discover
    res = rxv_details(url)
  File "/Library/Python/3.8/site-packages/rxv/ssdp.py", line 84, in rxv_details
    unit_desc_url_local = res.find(UNITDESC_URL_QUERY).text
AttributeError: 'NoneType' object has no attribute 'text'

The error message also looks similar to the one i originally got inside Home Assistant:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/discovery/__init__.py", line 196, in scan_devices
    results = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/discovery/__init__.py", line 226, in _discover
    for service in netdisco.get_info(disc):
  File "/usr/local/lib/python3.8/site-packages/netdisco/discovery.py", line 104, in get_info
    return self.discoverables[dis].get_info()
  File "/usr/local/lib/python3.8/site-packages/netdisco/discoverables/__init__.py", line 28, in get_info
    return [self.info_from_entry(entry) for entry in self.get_entries()]
  File "/usr/local/lib/python3.8/site-packages/netdisco/discoverables/__init__.py", line 28, in <listcomp>
    return [self.info_from_entry(entry) for entry in self.get_entries()]
  File "/usr/local/lib/python3.8/site-packages/netdisco/discoverables/yamaha.py", line 29, in info_from_entry
    service['X_unitDescURL'][1:])
KeyError: 'X_unitDescURL'

@esev
Copy link
Contributor

esev commented Jan 30, 2021

@PygmalionPolymorph Ah! progress :) Thanks for these updates!

Looks like maybe the desc.xml response doesn't contain all the elements that rxv is expecting.

What happens if you modify rxv a bit? Change these lines:

rxv/rxv/ssdp.py

Lines 91 to 92 in da90b75

unit_desc_url_local = res.find(UNITDESC_URL_QUERY).text
unit_desc_url = urljoin(url_base_el.text, unit_desc_url_local)

To something like this:

    unit_desc_url_local = res.find(UNITDESC_URL_QUERY)
    if unit_desc_url_local:
        unit_desc_url = urljoin(url_base_el.text, unit_desc_url_local.text)
    else:
        unit_desc_url = None

Could you post the response from http://192.168.1.101:49154/MediaRenderer/desc.xml? (the location header in the ssdp response). Feel free to edit/scrub any serial numbers or other identifiers. I think having this as a test case would be helpful in preventing future breakage for this specific device.

@william57m
Copy link

william57m commented Feb 11, 2021

Same issue for me, I have a RX-V4A.

It fails here https://github.com/wuub/rxv/blob/main/rxv/rxv.py#L137

http://192.168.2.148:80/YamahaRemoteControl/desc.xml doesn't returns anything.

I have been able to make it work in HA by changing the unit_desc_url to 'http://192.168.2.148:49154/RenderingControl/desc.xml
and returning self in def zone_controllers as it is not able to find the sub units from the xml file.

@william57m
Copy link

@esev here is the result of http://192.168.2.148:49154/MediaRenderer/desc.xml, I don't see the unitDescURL

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:yamaha="urn:schemas-yamaha-com:device-1-0">
   <specVersion>
      <major>1</major>
      <minor>0</minor>
   </specVersion>
   <device>
      <dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMR-1.50</dlna:X_DLNADOC>
      <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
      <friendlyName>Salon</friendlyName>
      <manufacturer>Yamaha Corporation</manufacturer>
      <manufacturerURL>http://www.yamaha.com/</manufacturerURL>
      <modelDescription>AV Receiver</modelDescription>
      <modelName>RX-V4A</modelName>
      <modelNumber>V4A</modelNumber>
      <modelURL>http://www.yamaha.com/</modelURL>
      <serialNumber />
      <UDN />
      <iconList>
         <icon>
            <mimetype>image/jpeg</mimetype>
            <width>48</width>
            <height>48</height>
            <depth>24</depth>
            <url>/Icons/48x48.jpg</url>
         </icon>
         <icon>
            <mimetype>image/jpeg</mimetype>
            <width>120</width>
            <height>120</height>
            <depth>24</depth>
            <url>/Icons/120x120.jpg</url>
         </icon>
         <icon>
            <mimetype>image/png</mimetype>
            <width>48</width>
            <height>48</height>
            <depth>24</depth>
            <url>/Icons/48x48.png</url>
         </icon>
         <icon>
            <mimetype>image/png</mimetype>
            <width>120</width>
            <height>120</height>
            <depth>24</depth>
            <url>/Icons/120x120.png</url>
         </icon>
      </iconList>
      <serviceList>
         <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/event</eventSubURL>
         </service>
         <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/event</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/event</eventSubURL>
         </service>
      </serviceList>
      <presentationURL>http://192.168.2.148/</presentationURL>
   </device>
   <yamaha:X_device>
      <yamaha:X_URLBase>http://192.168.2.148:80/</yamaha:X_URLBase>
      <yamaha:X_serviceList>
         <yamaha:X_service>
            <yamaha:X_specType>urn:schemas-yamaha-com:service:X_YamahaRemoteControl:1</yamaha:X_specType>
            <yamaha:X_controlURL>/YamahaRemoteControl/ctrl</yamaha:X_controlURL>
         </yamaha:X_service>
         <yamaha:X_service>
            <yamaha:X_specType>urn:schemas-yamaha-com:service:X_YamahaExtendedControl:1</yamaha:X_specType>
            <yamaha:X_yxcControlURL>/YamahaExtendedControl/v1/</yamaha:X_yxcControlURL>
            <yamaha:X_yxcVersion>0973</yamaha:X_yxcVersion>
         </yamaha:X_service>
      </yamaha:X_serviceList>
   </yamaha:X_device>
</root>

@DazWorrall
Copy link

@wuub did you make any progress with your new receiver? I have an RX-A6A myself and have been walking a path of issues leading me here 😅 Similar sorts of issues as above - discovery is broken because desc.xml is not quite as expected, but instantiating rxv.RXV by hand with ctrl_url works and I can control the unit via repl. I would love to help figure out a solution here so I can control the receiver through Home Assistant.

@wuub
Copy link
Owner

wuub commented Nov 21, 2022

@DazWorrall I did, by actually using this integration instead https://www.home-assistant.io/integrations/yamaha_musiccast/ because I added more musiccast devices to my home network

@DazWorrall
Copy link

I saw that integration and initially disregarded it because it didn't think it could control the source input of the receiver, but I dug deeper and found that it can, so it's good enough for my use case 👍

@wuub
Copy link
Owner

wuub commented Nov 21, 2022

Yeah, it's actually more feature rich than this library ever was.

For anyone looking, the source selection is in the usual place:

Screenshot 2022-11-21 at 12 50 10

@kuro6
Copy link

kuro6 commented Apr 25, 2023

@wuub I'm having the same problem with the Yamaha Network Receivers integration for my RX-A4A. My goal is to use yamaha.select_scene, which the MusicCast integration does not support. Any suggestions?

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

Successfully merging a pull request may close this issue.

7 participants