Yamaha Receiver (official intergration) works 1-2 times and then looses control. Update Problem

Unlikely, the error you posted is about malformed XML coming from the receiver. The issue most certainly resides in your receiver or the library that HA uses (which hasn’t been updated in 2 years).

Exactly the same problem here!

Yamaha RX-A2080 with latest firmware and network standby on. It worked for two days without issues! I dont’t know when it stopped working, maybe after a HA update or reboot. I’m able to ping the receiver, the android app works, I can browse the web menu. But the entity is not available.

Was anybody able to solve the issue? It’s very strange that it worked in the first place and then suddenly stopped working. Nothing was changed…

That’s a musiccast receiver and you should be using the musicast integration.

I’ve had this issue for a few months and haven’t had time to look into it. Now appears this thread is spot on. This is not a receiver problem as the receiver worked flawlessly until a few months ago, and works fine with iOS app and webpage while being unresponsive to HA.

Since the library hasn’t changed in two years, I think this points to a problem in Core HA rather than the library itself.

Logs aren’t capturing anything when command is issued. Do I need to add homeassistant.components.media_player.yamaha: debug to the logger to get it to register?

Did you update your firmware? I’ve locked my firmware on my receiver and haven’t updated anything. The integration works perfect still. This is likely not a core issue. The rxv library hasn’t been updated since 2018. Any firmware updates between then and now could break the library. Unfortunately, the owner of the code (outside HA) has not responded to anything in a long time. Depending on the license for his code, it may need to be forked and taken over by a new dev.

Logging on home assistants side only produces 2 warnings. With debug you’ll only get a list of controllers that are found or ignored. Nothing will occur when sending/receiving a command.


Also, good news. I just checked out the rxv library, and it looks like the dev came out of a slumber and there has been 2 updates.

With that being said, I recommend the people that are having an issue do the following:

  1. Create a custom_component folder inside your config folder.

  2. Create a yamaha folder inside that.

  3. Copy the contents of this directory into that folder.

  4. Modify the manifest.json file to have the following contents:

    {
      "domain": "yamaha",
      "name": "Yamaha Network Receivers",
      "documentation": "https://www.home-assistant.io/integrations/yamaha",
      "requirements": ["rxv==0.7.0rc2"],
      "codeowners": [],
      "iot_class": "local_polling"
    }
    
  5. Restart Home Assistat.

This will take the current home assistant library and use the updates that were delivered in January. If this fixes the problems, we can deliver it to the core.

Keep in mind that these are pre releases of rxv, so it may not fix the problem. If one of you could identify the problem, a PR against RXV could be created to address the issue now that it looks like the dev has returned.

EDIT: Also looks like someone opened up an issue against the core, and someone opened an issue in rxv. Is this the issue that’s occurring for you guys?

I just followed the steps you outlined and will report back how it goes. Right now I looked at my HA and it’s still available and controllable, but I restarted HA yesterday. I’ve noticed it typically breaks down after 3 days or so.

BTW, HA complained about missing version number in your manifest.json file: WARNING (MainThread) [homeassistant.loader] No ‘version’ key in the manifest file for custom integration ‘yamaha’. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of ‘yamaha’

Circling back on this. It appears the errors continue after HA has been online without restart for a few days. However, unlike the regular integration, this custom component does not lose the ability to control the receiver and continues to work even though the errors are logged.

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/yamaha/media_player.py:195
Integration: yamaha
First occurred: May 29, 2021, 4:00:19 AM (4 occurrences)
Last logged: 4:00:19 AM

Update for media_player.rx_v675 fails
Update for media_player.rx_v675_zone_2 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/xml/etree/ElementTree.py", line 1700, in close
    self.parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 316, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 524, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/yamaha/media_player.py", line 195, in update
    self._play_status = self.receiver.play_status()
  File "/usr/local/lib/python3.8/site-packages/rxv/rxv.py", line 574, in play_status
    src_name = self._src_name(self.input)
  File "/usr/local/lib/python3.8/site-packages/rxv/rxv.py", line 284, in input
    response = self._request('GET', request_text)
  File "/usr/local/lib/python3.8/site-packages/rxv/rxv.py", line 184, in _request
    response = cElementTree.XML(res.content)
  File "/usr/local/lib/python3.8/site-packages/defusedxml/common.py", line 132, in fromstring
    return parser.close()
  File "/usr/local/lib/python3.8/xml/etree/ElementTree.py", line 1702, in close
    self._raiseerror(v)
  File "/usr/local/lib/python3.8/xml/etree/ElementTree.py", line 1602, in _raiseerror
    raise err
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Logger: rxv
Source: /usr/local/lib/python3.8/site-packages/rxv/rxv.py:191
First occurred: May 29, 2021, 4:00:19 AM (4 occurrences)
Last logged: 4:00:19 AM

Invalid XML returned for request <YAMAHA_AV cmd="GET"><Main_Zone><Input><Input_Sel>GetParam</Input_Sel></Input></Main_Zone></YAMAHA_AV>: b''
Invalid XML returned for request <YAMAHA_AV cmd="GET"><Zone_2><Input><Input_Sel>GetParam</Input_Sel></Input></Zone_2></YAMAHA_AV>: b''
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/xml/etree/ElementTree.py", line 1700, in close
    self.parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/rxv/rxv.py", line 184, in _request
    response = cElementTree.XML(res.content)
  File "/usr/local/lib/python3.8/site-packages/defusedxml/common.py", line 132, in fromstring
    return parser.close()
  File "/usr/local/lib/python3.8/xml/etree/ElementTree.py", line 1702, in close
    self._raiseerror(v)
  File "/usr/local/lib/python3.8/xml/etree/ElementTree.py", line 1602, in _raiseerror
    raise err
  File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

I also noticed it’s getting an update error around 4AM every night:

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/yamaha/media_player.py:195
Integration: yamaha
First occurred: May 30, 2021, 4:00:17 AM (1 occurrences)
Last logged: May 30, 2021, 4:00:17 AM

Update for media_player.rx_v675 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1344, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 447, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='10.30.30.50', port=80): Read timed out. (read timeout=10.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 316, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_device_update
    await task
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/yamaha/media_player.py", line 195, in update
    self._play_status = self.receiver.play_status()
  File "/usr/local/lib/python3.8/site-packages/rxv/rxv.py", line 574, in play_status
    src_name = self._src_name(self.input)
  File "/usr/local/lib/python3.8/site-packages/rxv/rxv.py", line 284, in input
    response = self._request('GET', request_text)
  File "/usr/local/lib/python3.8/site-packages/rxv/rxv.py", line 177, in _request
    res = self._session.post(
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='10.30.30.50', port=80): Read timed out. (read timeout=10.0)

Hi, I used to have the Yamaha receiver integrated in Home Assistant for YEARS and was always working top perfect.

Since a month or so is not working anymore, any hint?

  • [RX-V675](http

Update it, for me even their app stops working when there is an update pending…

will try this solution now

2021-06-22 13:43:58 ERROR (SyncWorker_0) [homeassistant.loader] The custom integration ‘yamaha’ does not have a valid version key (None) in the manifest file and was blocked from loading. See https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions for more details


{

    "domain": "yamaha",

    "name": "Yamaha Network Receivers",

    "documentation": "https://www.home-assistant.io/integrations/yamaha",

    "requirements": ["rxv==0.7.0rc2"],

    "codeowners": [],

    "iot_class": "local_polling",

    "version": "1.0.0"

  }

Now it works, thanks

you need to add a version to the manifest, go take a look at the current integrations manifest file and use that version key.

Hi all :slight_smile:

Im using the yamaha integration to control a yamaha rx-a820 AVR. I had the same issue which Michael describes and fixed it with the help from petro. After the custom integration I had absolutely no problem with the yamaha control, every was working. Also when I was plugged off and plugged in the power cable.

Now I did an update from home assistant 2021.4.6 to 2021.7.1 and I have a new problem with the “play_media” function. Im using it to select and play a radio station.

Before the HA update the scripts was working! Now im getting the following error:

Logger: homeassistant.components.automation.start_playing_181_buzz
Source: components/yamaha/media_player.py:404
Integration: Automatisierung (documentation, issues)
First occurred: 14:41:22 (3 occurrences)
Last logged: 14:41:22

  • Spiel Radio wenn Sender ausgewählt wurde: Choose at step 1: choice 4: Error executing script. Unexpected error for call_service at pos 1: ‘xml.etree.ElementTree.Element’ object has no attribute ‘getchildren’
  • Spiel Radio wenn Sender ausgewählt wurde: Error executing script. Unexpected error for choose at pos 1: ‘xml.etree.ElementTree.Element’ object has no attribute ‘getchildren’
  • While executing automation automation.start_playing_181_buzz

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 371, in _async_step await getattr(self, handler)() File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 574, in _async_call_service_step await self._async_run_long_action(service_task) File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 535, in _async_run_long_action long_task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1491, in async_call task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1526, in _execute_service await handler.job.target(service_call) File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 278, in service_handler await script_entity.async_turn_on( File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 382, in async_turn_on await coro File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 404, in _async_run return await self.script.async_run(variables, context) File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1219, in async_run await asyncio.shield(run.async_run()) File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 353, in async_run await self._async_step(log_exceptions=False) File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 371, in _async_step await getattr(self, handler)() File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 571, in _async_call_service_step await service_task File “/usr/src/homeassistant/homeassistant/core.py”, line 1491, in async_call task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1526, in _execute_service await handler.job.target(service_call) File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 213, in handle_service await self.hass.helpers.service.entity_service_call( File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 658, in entity_service_call future.result() # pop exception if have File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 811, in async_request_call await coro File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 695, in _handle_entity_call await result File “/usr/src/homeassistant/homeassistant/components/media_player/init.py”, line 691, in async_play_media await self.hass.async_add_executor_job( File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/yamaha/media_player.py”, line 404, in play_media self.receiver.net_radio(media_id) File “/usr/local/lib/python3.9/site-packages/rxv/rxv.py”, line 632, in net_radio menu = self.menu_status() File “/usr/local/lib/python3.9/site-packages/rxv/rxv.py”, line 508, in menu_status for elt in current_list.getchildren() AttributeError: ‘xml.etree.ElementTree.Element’ object has no attribute ‘getchildren’

My script looks like:

play_buzz:
  alias: Play 181.FM Buzz
  sequence:
  - service: media_player.turn_on
    target:
      entity_id: media_player.yamaha_receiver
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: media_player.select_source
    target:
      entity_id: media_player.yamaha_receiver
    data:
      source: NET RADIO
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: media_player.play_media
    data:
      media_content_type: NET RADIO
      media_content_id: Lesezeichen>radio>181.fm - The Buzz
      entity_id: media_player.yamaha_receiver
  mode: single

I was also trying to update the files from github, because the modification date was modified last month and I was hoping it will maybe fix my issue, but it doesnt.

Can anyone confirm this issue and had a fix?

regards

Alex

yes, I have the same problem, I still don’t know a solution.

Hi Virgil,

sorry for my late response, I was on vacation. Well Ive also no solution, because of the low response of my topic, I thought Im alone with this problem. I just restored my backup and stay on 2021.4.6.

But I really want to update to the latest version… hopefully someone could help us :slight_smile:

Nothing changed for yamaha integration between then and now. Literally running the same backend. The backend rxv hasn’t updated in 2 years, that error is pointing to the backend. So the update between 2021.4 and now would have zero impact on this.

Hi petro,

maybe there is an configuration problem, but I cannot figured it out. The only change I did was the update. I will do it again and come back with the result.

Okay, I did the update to the latest 2021.8.1. I didnt change anything else and its still not working. The yamaha avr stucks on “Lesezeichen” and the logfiles shows me the same error from above.

There must be difference between the versions for this “play media” function. I dont know which components relevant to it, but there must be a difference.

Okay, just another update! To be really sure its not a problem of my environment, I was setting up an completely fresh installation of a second home assistant and just add the following to my config:

configuration.yaml:


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
media_player:
  - platform: yamaha

and here my script.yaml:

play_buzz:
  alias: Play 181.FM Buzz
  sequence:
  - service: media_player.turn_on
    target:
      entity_id: media_player.yamaha_receiver
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: media_player.select_source
    target:
      entity_id: media_player.yamaha_receiver
    data:
      source: NET RADIO
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: media_player.play_media
    data:
      media_content_type: NET RADIO
      media_content_id: Lesezeichen>radio>181.fm - The Buzz
      entity_id: media_player.yamaha_receiver

There are no other modification on this installation! Anything else is default and Ive the same issue as with my main home assistant installation. The Logfile:

Logger: homeassistant
Source: components/yamaha/media_player.py:404
First occurred: 17:46:18 (1 occurrences)
Last logged: 17:46:18

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.9/http/client.py", line 1349, in getresponse
    response.begin()
  File "/usr/local/lib/python3.9/http/client.py", line 316, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.9/http/client.py", line 285, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.9/http/client.py", line 1349, in getresponse
    response.begin()
  File "/usr/local/lib/python3.9/http/client.py", line 316, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.9/http/client.py", line 285, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 409, in _async_run
    return await self.script.async_run(script_vars, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1219, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 353, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 856, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 698, in async_play_media
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/yamaha/media_player.py", line 404, in play_media
    self.receiver.net_radio(media_id)
  File "/usr/local/lib/python3.9/site-packages/rxv/rxv.py", line 629, in net_radio
    self.input = "NET RADIO"
  File "/usr/local/lib/python3.9/site-packages/rxv/rxv.py", line 261, in input
    self._request('PUT', request_text)
  File "/usr/local/lib/python3.9/site-packages/rxv/rxv.py", line 148, in _request
    res = self._session.post(
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

You can’t use > symbols in media_content_id in yamaha integration, you never have been able to.

Change > to &gt and any < to &lt with out it, it will malform the xml. Not sure how it was working for you in the past.

media_content_id: Lesezeichen&gtradio&gt181.fm - The Buzz