core: UPNP Error setting up...

The problem

After a restart of HC Core this error shows up most of the time. Only when the IP-address 192.168.1.1 is found then it works. Not when the IP-address ::1 is found.

What is version of Home Assistant Core has the issue?

2021.10.0b4

What was the last working version of Home Assistant Core?

2021.8.x?

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

UPNP/IGD via async_upnp_client (tnx @balloob)

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: components/upnp/device.py:54
First occurred: 18:36:04 (1 occurrences)
Last logged: 18:36:04

Error setting up entry Archer AX11000 for upnp
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
    return await fut
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('::1', 1900, 0, 0)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/async_upnp_client/aiohttp.py", line 171, in _async_http_request
    async with self._session.request(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host ::1:1900 ssl:default [Connect call failed ('::1', 1900, 0, 0)]

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 125, in async_setup_entry
    device = await Device.async_create_device(hass, location)
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 61, in async_create_device
    upnp_device = await Device.async_create_upnp_device(hass, ssdp_location)
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 54, in async_create_upnp_device
    return await factory.async_create_device(ssdp_location)
  File "/usr/local/lib/python3.9/site-packages/async_upnp_client/client_factory.py", line 68, in async_create_device
    root_el = await self._async_get(description_url)
  File "/usr/local/lib/python3.9/site-packages/async_upnp_client/client_factory.py", line 369, in _async_get
    status_code, _, response_body = await self.requester.async_http_request(
  File "/usr/local/lib/python3.9/site-packages/async_upnp_client/aiohttp.py", line 139, in async_http_request
    return await self._async_http_request(method, url, headers, body)
  File "/usr/local/lib/python3.9/site-packages/async_upnp_client/aiohttp.py", line 193, in _async_http_request
    raise UpnpConnectionError(str(err)) from err
async_upnp_client.exceptions.UpnpConnectionError: Cannot connect to host ::1:1900 ssl:default [Connect call failed ('::1', 1900, 0, 0)]



### Additional information

When I delete the Integration and add it once more manually, then it works.

The log shows this just before the error: `Device discovered: uuid:e8c797e0-abcd-4f84-1234-088d7d77c6cd::urn:schemas-upnp-org:device:InternetGatewayDevice:1, at: http://[::1]:1900/rootDesc.xml`
The log show this before the success: `Device discovered: uuid:e8c797e0-abcd-4f84-12324-088d7d77c6cd::urn:schemas-upnp-org:device:InternetGatewayDevice:1, at: http://192.168.1.1:1900/rootDesc.xml`

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

I’ll try some restarts in the morning. Too tired now, long day 😃