8000 UPnP/IGD and AsusWRT Error with Pi-hole in System · Issue #26869 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

UPnP/IGD and AsusWRT Error with Pi-hole in System #26869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
barqers opened this issue Sep 24, 2019 · 20 comments
Closed

UPnP/IGD and AsusWRT Error with Pi-hole in System #26869

barqers opened this issue Sep 24, 2019 · 20 comments

Comments

@barqers
Copy link
barqers commented Sep 24, 2019

Home Assistant release with the issue:

0.99.2

Last working Home Assistant release (if known):
Not sure

Operating environment (Hass.io/Docker/Windows/etc.):

Component/platform:

AsusWRT and/or UPnp/IGD Integration

Description of problem:
Fails to connect to the router when Pi-hole is installed on the system. Does not create any blocked entries within pi-hole so do not believe the traffic is being blocked.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

None - UPnP/IGD integration in Hassio with Asus WRT router

Traceback (if applicable):


Additional information:
Log file gets spammed with entries every minute for:

2019-09-23 21:01:09 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.rt_ac1750_packets_sec_sent fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 924, in _wrap_create_connection
    await self._loop.create_connection(*args, **kwargs))
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 954, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 941, in create_connection
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 464, in sock_connect
    return await fut
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 494, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.x.x', 34575)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 198, in async_update
    new_value = await self._async_fetch_value()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 254, in _async_fetch_value
    return await self._device.async_get_total_packets_sent()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 165, in async_get_total_packets_sent
    return await self._igd_device.async_get_total_packets_sent()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/profiles/igd.py", line 120, in async_get_total_packets_sent
    result = await action.async_call()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 509, in async_call
    await self.service.requester.async_http_request('POST', url, headers, body)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 70, in async_http_request
    body_type=body_type)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/aiohttp.py", line 103, in async_do_http_request
    async with self._session.request(method, url, headers=headers, data=body) as response:
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1005, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 476, in _request
    timeout=real_timeout
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 522, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 854, in _create_connection
    req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 992, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 974, in _create_direct_connection
    req=req, client_error=client_error)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 931, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.x.x:34575 ssl:None [Connect call failed ('192.168.x.x', 34575)]
@barqers barqers changed the title AsusWRT Error with Pi-hole in System UPnP/IGD and AsusWRT Error with Pi-hole in System Sep 24, 2019
@probot-home-assistant
Copy link
probot-home-assistant bot commented 8000 Sep 24, 2019

Hey there @kennedyshead, mind taking a look at this issue as its been labeled with a integration (asuswrt) you are listed as a codeowner for? Thanks!

@probot-home-assistant
Copy link

Hey there @robbiet480, mind taking a look at this issue as its been labeled with a integration (upnp) you are listed as a codeowner for? Thanks!

@dgomes
Copy link
Contributor
dgomes commented Sep 25, 2019

CC @StevenLooman

@StevenLooman
Copy link
Contributor
StevenLooman commented Sep 28, 2019

A few checks, can you, from your own computer, connect to http://192.168.x.x:34575 ?

Also, was the integration itself set up and 'initialized'? I.e., do you see the UPnP sensors (traffic counters etc) in your home assistant?

@barqers
Copy link
Author
barqers commented Oct 2, 2019

A few checks, can you, from your own computer, connect to http://192.168.x.x:34575 ?

Also, was the integration itself set up and 'initialized'? I.e., do you see the UPnP sensors (traffic counters etc) in your home assistant?

Hey Steven, sorry for the slow reply. I cannot access that URL in my web browser - the router doesn't seem to be responding to http requests on that port (with or without pihole running btw).

However, previously they were working and pulling the upnp sensors in HA. They no longer pull the data and instead flood the log files with the above error.

I noticed my router is not running merlin (if that matters) and so only has telnet, not SSH enabled.

@StevenLooman
Copy link
Contributor

Did you change the IP to you routers IP?

Also, have you tried removing and adding the integration?

Is there anything else that has changed?

Not sure what merlin is, the point is that it should be running a UPnP/IGD server. If you haveshell- access to the home-assistant environment you can run this to discover/search for the UPnP devices on your network:

$ upnp-client search

This will output something like:

{"Cache-Control": "max-age=1900", "Location": "http://192.168.178.1:80/RootDevice.xml", "Server": "UPnP/1.0 UPnP/1.0 UPnP-Device-Host/1.0", "ST": "upnp:rootdevice", "USN": "uuid:upnp-InternetGatewayDevice-1_0-889ffacb9043::upnp:rootdevice", "EXT": "", "_timestamp": "2019-10-12 12:34:50.839151", "_address": "192.168.178.1:1900", "_udn": "uuid:upnp-InternetGatewayDevice-1_0-889ffacb9043", "_source": "search"}
{"Cache-Control": "max-age=1900", "Location": "http://192.168.178.1:80/RootDevice.xml", "Server": "UPnP/1.0 UPnP/1.0 UPnP-Device-Host/1.0", "ST": "uuid:upnp-InternetGatewayDevice-1_0-889ffacb9043", "USN": "uuid:upnp-InternetGatewayDevice-1_0-889ffacb9043", "EXT": "", "_timestamp": "2019-10-12 12:34:50.839446", "_address": "192.168.178.1:1900", "_udn": "uuid:upnp-InternetGatewayDevice-1_0-889ffacb9043", "_source": "search"}
...

@thundergreen
Copy link

I got also this error. I added this upnp by integration and after a while it throws this error:

Tue Nov 05 2019 19:04:56 GMT+0100 (Mitteleuropäische Normalzeit)
Update for sensor.rt_ac68u_bytes_sent fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 954, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 941, in create_connection
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 464, in sock_connect
    return await fut
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 494, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.1.1', 47779)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 270, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 143, in async_update
    self._state = await self._device.async_get_total_bytes_sent()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 151, in async_get_total_bytes_sent
    return await self._igd_device.async_get_total_bytes_sent()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/profiles/igd.py", line 99, in async_get_total_bytes_sent
    result = await action.async_call()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 509, in async_call
    await self.service.requester.async_http_request('POST', url, headers, body)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 70, in async_http_request
    body_type=body_type)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/aiohttp.py", line 103, in async_do_http_request
    async with self._session.request(method, url, headers=headers, data=body) as response:
  Fi
8000
le "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
    timeout=real_timeout
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _create_direct_connection
    req=req, client_error=client_error)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.1:47779 ssl:None [Connect call failed ('192.168.1.1', 47779)]

trying this in browser gives me connection refused.. . Re-adding the integration will work a certain time but will fail after a while

@StevenLooman
Copy link
Contributor

Not sure what is happening. Your device might be blocking the updates as a means of protection.

Does it work again later on, or only if you re-add the integration?

@thundergreen
Copy link
thundergreen commented Nov 11, 2019 via email

@StevenLooman
Copy link
Contributor

Does it eventually work again, without re-adding the integration? I.e., does your router start responding again after a while, without you doing anything?

@thundergreen
Copy link

I did not really follow this up the last days. but all of udden the sensor stops collecting data and there are error logs regarding that hass cannot connect to the router... restarting hass fixes it. Also i noticed my keyfile and if using the sensors from the component breaks this component somehow. i am using last dev veriosn 0.102.0b2 for the moment.

@StevenLooman
Copy link
Contributor

What do you mean by keyfile?

Do you know how to use custom components? It is worth trying to re-initialize the backend of this component periodically, but I don't want to change it before it is certain this works.

@thundergreen
Copy link

@StevenLooman i meant the ssh keyfile instead of password. It breaks my asuswrt component completly. I would go for a custom component yeah. I have the feeling something is broken with asuswrt component for the moment.

@barqers
Copy link
Author
barqers commented Nov 25, 2019

@thundergreen @StevenLooman Didn't mean to leave you both hanging but I've just switched to a NetGear Orbi and I'm no longer having issues with the UPnP/IGD component. The last router I had issues on was my Asus RT-AC1750. So it seems the problem is only for Asus routers.

@StevenLooman
Copy link
Contributor

@thundergreen Hi sorry for the delay. I have changed the sensors of the upnp component to reinitialize every hour, see this commit. Please know this is just a test and I have no intention to let this land in Home Assistant itself!

Do you know what to do with this? You can either create a custom component (recommended, copy the files from the upnp component to the custom component and apply the changes in the commit), or edit the python files in your Home Assistant installation.

@jacekpaszkowski
Copy link
Contributor

in addition to this and my issue #30896 (which was marked as duplicate) i also get some timeout errors but sesnors work. Of course till next restart.

2020-01-17 19:17:10 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.openwrt_router_packets_sec_received fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/aiohttp.py", line 103, in async_do_http_request
    async with self._session.request(method, url, headers=headers, data=body) as response:
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 200, in async_update
    new_value = await self._async_fetch_value()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 254, in _async_fetch_value
    return await self._device.async_get_total_packets_received()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 153, in async_get_total_packets_received
    return await self._igd_device.async_get_total_packets_received()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/profiles/igd.py", line 110, in async_get_total_packets_received
    result = await action.async_call()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 509, in async_call
    await self.service.requester.async_http_request('POST', url, headers, body)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 70, in async_http_request
    body_type=body_type)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/aiohttp.py", line 113, in async_do_http_request
    resp_body = None
  File "/usr/local/lib/python3.7/site-packages/async_timeout/__init__.py", line 55, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.7/site-packages/async_timeout/__init__.py", line 92, in _do_exit
    raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError
2020-01-17 19:17:11 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.openwrt_router_packets_sec_sent fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/aiohttp.py", line 103, in async_do_http_request
    async with self._session.request(method, url, headers=headers, data=body) as response:
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 847, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 591, in read
    await self._waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 200, in async_update
    new_value = await self._async_fetch_value()
  File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 256, in _async_fetch_value
    return await self._device.async_get_total_packets_sent()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 157, in async_get_total_packets_sent
    return await self._igd_device.async_get_total_packets_sent()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/profiles/igd.py", line 120, in async_get_total_packets_sent
    result = await action.async_call()
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 509, in async_call
    await self.service.requester.async_http_request('POST', url, headers, body)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/client.py", line 70, in async_http_request
    body_type=body_type)
  File "/usr/local/lib/python3.7/site-packages/async_upnp_client/aiohttp.py", line 113, in async_do_http_request
    resp_body = None
  File "/usr/local/lib/python3.7/site-packages/async_timeout/__init__.py", line 55, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.7/site-packages/async_timeout/__init__.py", line 92, in _do_exit
    raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError

8000

@jaydub385
Copy link

same issue as jacekpaszkowski with the timeout error. Home Assistant 0.104.2. Sometimes after removing the entities and restarting they come back. Any way to force a rediscovery?

@StevenLooman
Copy link
Contributor

Nothing has changed in recent versions of Home Assistant. Reinitialization (not rediscovery) is done in the commit from this comment, albeit in a hacky and certainly not a production-usable way. Please test this if you have the means and knowledge on how to do so.

@stale
Copy link
stale bot commented Apr 23, 2020

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.

@stale stale bot added the stale label Apr 23, 2020
@StevenLooman
Copy link
Contributor

A lot has changed with #33108 and will be included in the next release. This can be closed @robbiet480 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
0