Core: Yamaha RXV Zone_2 not working anymore after Update to 0.78.0

Created on 19 Sep 2018  Â·  26Comments  Â·  Source: home-assistant/core

Home Assistant release with the issue:
0.78.0

Last working Home Assistant release (if known):
0.77.3

Operating environment (Hass.io/Docker/Windows/etc.):
gentoo linux amd64 current stable profile 17.0 nomultilib (very thin install)

except the follwing python updates required by home-assistant:

  • dev-python/astral-1.6.1
  • dev-python/attrs-18.2.0
  • dev-python/cryptography-2.3.1
  • dev-python/pyjwt-1.6.4
  • dev-python/voluptuous-0.11.5
  • dev-python/pyyaml-3.13
  • dev-python/aiohttp-cors-0.6.0
  • dev-python/bcrypt-3.1.4
  • dev-python/idna-ssl-1.0.1
  • dev-python/async_timeout-3.0.0

with the 0.78.0 update

  • dev-python/voluptuous-serialize-2.0.0
  • dev-python/colorlog-3.1.4
    were newly installed and
  • dev-python/aiohttp-3.4.0
    has been updated.

Component/platform:
Yamaha RXV-679, platform: yamaha (worked great up to now), also tried yamaha_musiccast without success. All Yamahas are on wired network, Firmware is 2.10, will also try current FW 2.58 tomorrow.

Description of problem:
Since Upgrade to 0.78.0 Zone_2 does not show up anymore, lots of tracebacks.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
removed source_ignore and source_names for testing:

- platform: yamaha
  name: RXV_Werkstatt
  host: rxv679-werkstatt.in.xxx.net
  zone_ignore:
    - "Zone_2"
  zone_names:
    Main_Zone: "Werkstatt"

- platform: yamaha
  name: RXV_Wohnzimmer
  host: rxv679-wohnen.in.xxx.net
  zone_names:
    Zone_2: "TerasseR"
    Main_Zone: "Wohnzimmer"

- platform: yamaha
  name: RXV_Kitchen
  host: rxv679-kueche.in.xxx.net
  zone_names:
    Main_Zone: "Kueche"
    Zone_2: "BadezimmerEG"

Traceback (if applicable):

2018-09-19 22:55:46 ERROR (SyncWorker_35) [rxv] Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
Traceback (most recent call last):
  File "/etc/homeassistant/deps/lib64/python3.6/site-packages/rxv/rxv.py", line 139, in _request
    response = ET.XML(res.content)  # releases connection to the pool
  File "/usr/lib64/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
2018-09-19 22:55:46 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.rxv_kitchen_kzone2 fails
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/homeassistant/helpers/entity.py", line 224, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/lib64/python3.6/site-packages/homeassistant/helpers/entity.py", line 353, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib64/python3.6/site-packages/homeassistant/components/media_player/yamaha.py", line 187, in update
    self._sound_mode = self.receiver.surround_program
  File "/etc/homeassistant/deps/lib64/python3.6/site-packages/rxv/rxv.py", line 296, in surround_program
    response = self._request('GET', request_text)
  File "/etc/homeassistant/deps/lib64/python3.6/site-packages/rxv/rxv.py", line 139, in _request
    response = ET.XML(res.content)  # releases connection to the pool
  File "/usr/lib64/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

Error shows up every 11 seconds.
Additional information:

zone_ignore:
    - "Zone_2"

lets errors & tracebacks vanish.
Thanks a lot for your great work!

bug yamaha

Most helpful comment

... just upgraded to 0.80.3, update still contains the old version. How long does it take into the release version?

All 26 comments

Same with current Yamaha Firmware, updated to 2.58

I have this problem as well with zone 2. Almost identical error messages.
HA 78.1, Python 3.5, Yamaha RX-V671
( https://github.com/home-assistant/home-assistant/pull/16352 is the PR that broke it.)

cc @Joshi425

command <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV> returns empty string cause XML parse error.

If upstream lib cannot better handle exception, then HA should handle it.

Same problem. Getting the following in the log every 10 sec:

    2018-09-21 23:26:45 ERROR (SyncWorker_13) [rxv] Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 139, in _request
        response = ET.XML(res.content)  # releases connection to the pool
      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
    2018-09-21 23:26:46 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.yamaha_receiver_zone_2 fails
    Traceback (most recent call last):
      File "/usr/src/app/homeassistant/helpers/entity.py", line 224, in async_update_ha_state
        yield from self.async_device_update()
      File "/usr/src/app/homeassistant/helpers/entity.py", line 353, in async_device_update
        yield from self.hass.async_add_job(self.update)
      File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/usr/src/app/homeassistant/components/media_player/yamaha.py", line 187, in update
        self._sound_mode = self.receiver.surround_program
      File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 296, in surround_program
        response = self._request('GET', request_text)
      File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 139, in _request
        response = ET.XML(res.content)  # releases connection to the pool
      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

Same issue here with RX-V671.

RX-V673 with same issue with same error logging.

Same here with RX-A3020

Update for media_player.yamaha_receiver_uterum fails
19:56 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:56 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:56 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:56 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:55 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:55 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:55 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:55 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:55 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:55 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:55 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:55 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:55 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:55 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:54 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:54 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:54 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:54 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:54 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:54 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:54 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:54 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:54 components/media_player/yamaha.py (ERROR)
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
19:54 /usr/local/lib/python3.6/site-packages/rxv/rxv.py (ERROR)
Update for media_player.yamaha_receiver_uterum fails
19:54 components/media_player/yamaha.py (ERROR)

@Joshi425 + @fabaff - Anything you can think of that could quickly solve this?

Please try the following diff and report back if it fixes the behavior: https://github.com/Joshi425/home-assistant/commit/066853553e720dd93f535d49aa15ae61f9103d95

I'm not a 100% sure how to do this, please review and let me know if I should have done it differently:

root@optiserv:/usr/src/app# cd /usr/src/app/homeassistant/components/media_player/
root@optiserv:/usr/src/app/homeassistant/components/media_player# rm yamaha.py
root@optiserv:/usr/src/app/homeassistant/components/media_player# wget https://raw.githubusercontent.com/Joshi425/home-assistant/066853553e720dd93f535d49aa15ae61f9103d95/ho/components/media_player/yamaha.py
--2018-09-25 08:07:40--  https://raw.githubusercontent.com/Joshi425/home-assistant/066853553e720dd93f535d49aa15ae61f9103d95/homeassistant/components/media_player/yamaha.py
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.192.133, 151.101.128.133, 151.101.64.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.192.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13430 (13K) [text/plain]
Saving to: ‘yamaha.py’

yamaha.py                                       0%[                                                                                                 ]       0  --.-KB/syamaha.py                                     100%[================================================================================================>]  13.12K  --.-KB/s    in 0.009s

2018-09-25 08:07:40 (1.43 MB/s) - ‘yamaha.py’ saved [13430/13430]

root@optiserv:/usr/src/app/homeassistant/components/media_player# ls -la y*
-rw-r--r-- 1 root root 13430 Sep 25 08:07 yamaha.py
-rw-r--r-- 1 root root  9027 Sep 22 03:01 yamaha_musiccast.py
root@optiserv:/usr/src/app/homeassistant/components/media_player#

Then I restarted docker. Logs as follows:

2018-09-25 08:04:22 ERROR (SyncWorker_4) [rxv] Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 139, in _request
    response = ET.XML(res.content)  # releases connection to the pool
  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
2018-09-25 08:04:22 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.yamaha_receiver_zone_2 fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/media_player/yamaha.py", line 188, in update
    self._sound_mode = self.receiver.surround_program
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 296, in surround_program
    response = self._request('GET', request_text)
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 139, in _request
    response = ET.XML(res.content)  # releases connection to the pool
  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
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 224, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 353, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/media_player/yamaha.py", line 189, in update
    except ParseError:
NameError: name 'ParseError' is not defined

16697 Seems related. I'm getting the errors about Zone2 as well

@poldim you did it correct, can you please try the following:

https://raw.githubusercontent.com/Joshi425/home-assistant/dev/homeassistant/components/media_player/yamaha.py

it should catch all exeptions and return None, which disables the Sound_mode capability if
self.receiver.surround_program or self.receiver.surround_programs() throws an exeption.

With this way it should work in both cases.

Did the same thing, here is the result

2018-09-26 16:52:32 ERROR (SyncWorker_12) [rxv] Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Surround><Program_Sel><Current>GetParam</Current></Program_Sel></Surround></Zone_2></YAMAHA_AV>: b''
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 139, in _request
    response = ET.XML(res.content)  # releases connection to the pool
  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

2018-09-26 16:52:40 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 410, in start
    await resp.prepare(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_response.py", line 300, in prepare
    return await self._start(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_response.py", line 608, in _start
    return await super()._start(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_response.py", line 367, in _start
    await writer.write_headers(status_line, headers)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/http_writer.py", line 110, in write_headers
    self._write(buf)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/http_writer.py", line 67, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport

Thanks @Joshi425 - this works for me. I copied it over the other yamaha.py, restarted, and everything seems fine: no errors in logs, control works. Good one.

Thanks @Joshi425 - This works for me as well.

Can someone with a MultiZone Setup please test the component again:
https://raw.githubusercontent.com/Joshi425/home-assistant/dev/homeassistant/components/media_player/yamaha.py

Works great! Thank you!

Could someone help me out? I'm having the same issue with zone 2. I'm trying to replace my yamaha.py but I do not have that file or the directory structure mentioned. I'm using the SSL add-on to connect to HASSIO. Do I need to access a docker container or something to get to it?

I had the same problem you need to add a custom component to HASS.io and add the new Yamaha.py file into that. I think you put the new folders under config and the new directories need to be custom_component and then media_player then the new file.

Thanks a lot, @Joshi425, works.
Sorry, took some days before testing, was too busy :-)
In my gentoo setup the lib was in
"/usr/lib64/python3.6/site-packages/homeassistant/components/media_player/yamaha.py".
Currently on homeassistant 0.80.2:
Works good. No Errors in log, control of Zone_2 works, too.
Sound Mode Selector now only appears in Main Zone.

I had the same problem you need to add a custom component to HASS.io and add the new Yamaha.py file into that. I think you put the new folders under config and the new directories need to be custom_component and then media_player then the new file.

Thanks. That worked.

... just upgraded to 0.80.3, update still contains the old version. How long does it take into the release version?

Can someone dumb it down a little for us noobs? I have ssh access to my hassio on my rpi3. How do I import this new yamaha.py file to that location? I have searched and cannot find it. Thank you.

Can someone dumb it down a little for us noobs? I have ssh access to my hassio on my rpi3. How do I import this new yamaha.py file to that location? I have searched and cannot find it. Thank you.

Look at javajoeuk's reply. In your config folder (where your configuration.yaml and all is) create a custom_components folder and a media_player folder under that. Then drop the yamaha.py file in there. So:
\\HASSIOconfigcustom_components\media_playeryamaha.py

Arrrg, got it! In his last post he wrote "custom_component" and for the life of me I couldn't get it to work, it needed to be "custom_components"! That "s" makes a big difference!! Thank you!

Hey guys, i don't know if i'm facing the same problem as described here, but actually my receiver also isn't responding on home assistant, except i can switch it on (but not off again).
Thanks to @pharpe i was able to drop the yamaha.py in the media_player folder but i still see error messages in the log and still can't use the receiver.
here's what the error log shows me, spamming every 10 seconds:

2018-10-24 11:51:36 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.rxv475 fails

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_job(self.update)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self  # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.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 "/home/homeassistant/.homeassistant/custom_components/media_player/yamaha.py", line 161, in update
self._play_status = self.receiver.play_status()
File "/home/homeassistant/.homeassistant/deps/lib/python3.5/site-packages/rxv/rxv.py", line 437, in play_status
playing = (res.find(".//Playback_Info").text == "Play")
AttributeError: 'NoneType' object has no attribute 'text'
Was this page helpful?
0 / 5 - 0 ratings