home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.89k stars 30.12k forks source link

Yamaha MusicCast receivers doesn't provide desc.xml #18775

Closed cadavre closed 5 years ago

cadavre commented 5 years ago

Component/platform:

media_player.yamaha

Description of problem:

I have Yamaha R-N602D. Device is being configured OK with all available functions operating well. Yet I'm receiving an error while trying to fetch desc.xml file on init, because it's simply... not there.

Traceback (if applicable):

Invalid XML returned for request http://192.168.1.33:80/YamahaRemoteControl/desc.xml: b''
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/rxv/rxv.py", line 101, in _discover_features
    self._desc_xml = ET.fromstring(desc_xml)
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 1345, in XML
    return parser.close()
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Additional information:

If I try to visit http://192.168.1.33:80/YamahaRemoteControl/desc.xml via browser or API client – it gives me ERR_INVALID_RESPONSE with empty body. Looks simply like 404.

Yamaha MusicCast firmware version is 1.30 (released 2018-10-04).

balloobbot commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

fmonday commented 5 years ago

Same problem here, but I can't get the Yamaha component to load at all. I saw in an unrelated forum (maybe smart things) that the newer Musiccast devices required an updated URL; sounds like this needs to be updated in media_player.yamaha

2019-02-24 22:33:32 INFO (MainThread) [homeassistant.loader] Loaded media_player.yamaha from homeassistant.components.media_player.yamaha
2019-02-24 22:33:32 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.yamaha
2019-02-24 22:33:32 ERROR (Thread-14) [rxv] Unsupported Yamaha device? Failed to fetch http://192.168.1.153:80/YamahaRemoteControl/desc.xml
2019-02-24 22:33:32 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform yamaha
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/yamaha.py", line 88, in setup_platform
    unit_desc_url=desc_url).zone_controllers()
  File "/srv/homeassistant/lib/python3.5/site-packages/rxv/rxv.py", line 392, in zone_controllers
    for zone in self.zones():
  File "/srv/homeassistant/lib/python3.5/site-packages/rxv/rxv.py", line 383, in zones
    xml = self._desc_xml
AttributeError: 'RXV' object has no attribute '_desc_xml'
mmalina commented 5 years ago

I'm seeing the same issue. I'm using the yamaha_musiccast component though. All the controls work for me, but I'm seeing this error when setting up the component.

2019-03-10 09:20:17 ERROR (SyncWorker_1) [rxv] Unsupported Yamaha device? Failed to fetch http://192.168.1.4:80/YamahaRemoteControl/desc.xml
2019-03-10 09:20:18 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform yamaha
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/yamaha.py", line 88, in setup_platform
    unit_desc_url=desc_url).zone_controllers()
  File "/usr/local/lib/python3.7/site-packages/rxv/rxv.py", line 392, in zone_controllers
    for zone in self.zones():
  File "/usr/local/lib/python3.7/site-packages/rxv/rxv.py", line 383, in zones
    xml = self._desc_xml
AttributeError: 'RXV' object has no attribute '_desc_xml'

I have home assistant 0.88.2 via hass.io on raspberry pi 2b.

EDIT: Oh I see what's happening in my case. I was curious why the error mentions media_player/yamaha.py when in fact I have yamaha_musiccast set up. So I removed my definition and I still get the error. So it seems discovery tries to set up my Yamaha R-N402D as yamaha, but that doesn't work. My manual yamaha_musiccast setup does work.

cadavre commented 5 years ago

@robbiet480 this actually is about integration:yamaha_musiccast.

cadavre commented 5 years ago

Ok, I made some digging and this is what I've found:

Logs

2019-03-27 21:43:44 INFO (MainThread) [homeassistant.components.discovery] Found new service: yamaha {'host': '192.168.1.33', 'port': 49154, 'ssdp_description': 'http://192.168.1.33:49154/MediaRenderer/desc.xml', 'name': 'Yamaha R-N602', 'model_name': 'R-N602', 'model_number': 'N602', 'serial': '0549EDB3', 'manufacturer': 'Yamaha Corporation', 'udn': 'uuid:9ab0c000-f668-11de-9976-ac44f24f28e4', 'upnp_device_type': 'urn:schemas-upnp-org:device:MediaRenderer:1', 'control_url': 'http://192.168.1.33:80/YamahaRemoteControl/ctrl', 'description_url': 'http://192.168.1.33:80/YamahaRemoteControl/desc.xml'}
2019-03-27 21:43:44 INFO (MainThread) [homeassistant.loader] Loaded media_player.yamaha from homeassistant.components.media_player.yamaha
2019-03-27 21:43:44 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.yamaha
2019-03-27 21:43:44 ERROR (SyncWorker_2) [rxv] Invalid XML returned for request http://192.168.1.33:80/YamahaRemoteControl/desc.xml: b''
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 101, in _discover_features
    self._desc_xml = ET.fromstring(desc_xml)
  File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1315, in XML
    return parser.close()
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
2019-03-27 21:43:44 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform yamaha
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/yamaha.py", line 86, in setup_platform
    unit_desc_url=desc_url).zone_controllers()
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 95, in __init__
    self._discover_features()
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 101, in _discover_features
    self._desc_xml = ET.fromstring(desc_xml)
  File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1315, in XML
    return parser.close()
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Above logs shows that this error is triggered by discovery component that discovers Yamaha, but incorrectly as old-fashioned platform (RVX- models) and tries to set it up from discovery which fails, because of wrong URL to desc.xml.

What is more – platform is also discovered as dlna_dmr:

Logs

2019-03-27 21:43:44 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: dlna_dmr {'host': '192.168.1.33', 'port': 49154, 'ssdp_description': 'http://192.168.1.33:49154/MediaRenderer/desc.xml', 'name': 'Yamaha R-N602', 'model_name': 'R-N602', 'model_number': 'N602', 'serial': '0549EDB3', 'manufacturer': 'Yamaha Corporation', 'udn': 'uuid:9ab0c000-f668-11de-9976-ac44f24f28e4', 'upnp_device_type': 'urn:schemas-upnp-org:device:MediaRenderer:1'}
cadavre commented 5 years ago

Final thoughts. The problem is actually in https://github.com/home-assistant/netdisco/blob/master/netdisco/discoverables/yamaha.py which wrongly discovers devices as yamaha.

Continuing here: https://github.com/home-assistant/netdisco/issues/248

Sorry for multiple commends one after another.

mmalina commented 5 years ago

Thanks for the investigation, @cadavre . That was my thinking as well - that it's a bug in discovery where it's wrongly discovered as yamaha. BTW as a workaround for this you can exclude yamaha from discovery like this:

discovery:
  ignore:
    - yamaha
stale[bot] commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

upwindanderl commented 4 years ago

I guess it was wrong to close this issue!

In my case the only way to solve this error was by using @mmalina 's hint while doing this ignore thing

`discovery: ignore:

I updatet my HA just a minute ago, so i guess i'm on the latest version