Open borski opened 3 years ago
Does it work w/ the official app https://play.google.com/store/apps/details?id=com.yamaha.av.avcontroller&hl=en&gl=US?
Yes, works without an issue using the Yamaha app
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()
2) Checking if manual control works
import rxv
r = http://192.168.1.xxx:80/YamahaRemoteControl/ctrl
r.basic_status
It does not, and visiting /YamahaRemoteControl/ctrl
in a browser returns a 400 Bad Request :(
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?
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
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()
[]
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
Yes, but the raspi doesn't, unless I'm mistaken? aka Home Assistant should be able to do the discovery just fine.
@esev I made the change, locally, to force it try each interface; that isn't the issue. Good thought, though!
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.
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!
@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.
https://github.com/wuub/rxv/blob/da90b758da6e1cd5082bd8931f183662e54b1903/rxv/ssdp.py#L21-L27
FWIW, my RX-V577 responds to upnp:rootdevice
, urn:schemas-upnp-org:service:RenderingControl:1
and urn:schemas-upnp-org:device:MediaRenderer: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': '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'
@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:
https://github.com/wuub/rxv/blob/da90b758da6e1cd5082bd8931f183662e54b1903/rxv/ssdp.py#L91-L92
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.
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.
@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>
@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.
@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
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 👍
Yeah, it's actually more feature rich than this library ever was.
For anyone looking, the source selection is in the usual place:
@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?
Hi! For some reason,
rxv
doesn't seem to work with the RX-V6A receiver. Is this a known issue?