HA log flooded with connection errors after turning off Yamaha receiver

I have a Yamaha RX-V475 receiver that is auto recognized by HA, which is ok, even though I don’t use the device in HA currently.

This device has two different standby modes. An “active” standby, that basically turns off the display, but leaves almost everything else running, especially the network device, thus it can be turned on again via the LAN interface. The second mode is a deep (i.e. real) standby, that turns of everything except the IR receiver unit. In this mode, the network device is also shut down and the receiver is no longer available via it’s IP address.

The problem: After switching of the device, the HA log get’s flooded with connection errors several times a minute, until I restart HA. This issue also seems to severely affect the HA server performance. Commands are only executed with a lag of several seconds and triggering automations seems to get unreliable:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.4.14', port=80): Max retries exceeded with url: /YamahaRemoteControl/ctrl (Caused by NewConnectionError('<urllib3.connec
tion.HTTPConnection object at 0x7f2cb6d9aa20>: Failed to establish a new connection: [Errno 113] No route to host',))
2018-05-02 10:54:35 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.diebeatbox fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f2cb6dba5f8>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.4.14', port=80): Max retries exceeded with url: /YamahaRemoteControl/ctrl (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2cb6dba5f8>: Failed to establish a new connection: [Errno 113] No route to host',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 327, 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 154, in update
    self._play_status = self.receiver.play_status()
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 427, in play_status
    src_name = self._src_name(self.input)
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 239, in input
    response = self._request('GET', request_text)
  File "/usr/local/lib/python3.6/site-packages/rxv/rxv.py", line 137, in _request
    headers={"Content-Type": "text/xml"}
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 555, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.4.14', port=80): Max retries exceeded with url: /YamahaRemoteControl/ctrl (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2cb6dba5f8>: Failed to establish a new connection: [Errno 113] No route to host',))
2018-05-02 10:54:35 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/xknx/io/tunnel.py", line 183, in do_heartbeat
    await self.do_heartbeat_impl()
  File "/usr/local/lib/python3.6/site-packages/xknx/io/tunnel.py", line 187, in do_heartbeat_impl
    connectionsstate = await self.connectionstate()
  File "/usr/local/lib/python3.6/site-packages/xknx/io/tunnel.py", line 148, in connectionstate
    await conn_state.start()
  File "/usr/local/lib/python3.6/site-packages/xknx/io/request_response.py", line 35, in start
    await self.send_request()
  File "/usr/local/lib/python3.6/site-packages/xknx/io/request_response.py", line 45, in send_request
    self.udpclient.send(knxipframe)
  File "/usr/local/lib/python3.6/site-packages/xknx/io/udp_client.py", line 178, in send
    self.transport.sendto(bytes(knxipframe.to_knx()))
  File "uvloop/handles/udp.pyx", line 155, in uvloop.loop.UDPTransport.sendto
AttributeError: 'uvloop.loop.UDPTransport' object has no attribute '_address'

HA doesn’t seem to accept, that the component is gone and doesn’t give up reaching it. How can this be avoided?

BTW: I’m using a small arduino based and network enabled IR transmitter anyway, that remote controls this receiver and some more pre IoT era devices via network. Thus, I don’t want to use active standby mode just to workaround this issue. I’d rather hide the device completely from HA, to get rid of the problem.

If you don’t want to use it, ignore it in discovery. FWIW, I have a similar yamaha reciever RX-V674 I think? There was some configurations that were needed to enable over the network communication.

Anyways, here’s the documentation needed for ignoring components during discovery:

Thanks for the head up. For now I’m hiding the receiver from auto discovery as a workaround.

There was some configurations that were needed to enable over the network communication.

If the receiver is turned on while running or restarting HA, the network communication works without issues. The widget pops up and is working fine in HA. But it seems that HA doesn’t deal well with an already discovered device disappearing from the network.

I think I’ll open an issue for this on GitHub.