core icon indicating copy to clipboard operation
core copied to clipboard

UPnP/IGD integration „Failed setup“

Open hegien opened this issue 1 year ago • 8 comments

The problem

The UPnP/IGD integration shows „Failed setup“ in the integrations panel.

UPnP is enabeled on the Fritz!Box, restart of the Fritz!Box didn‘t solve the issue.

What version of Home Assistant Core has the issue?

2024.10.0

What was the last working version of Home Assistant Core?

2024.9.x (dont remember an issue during the last weeks)

What type of installation are you running?

Home Assistant Container

Integration causing the issue

UPnP/IGD

Link to integration documentation on our website

No response

Diagnostics information

InternetGatewayDeviceV2 - FRITZ!Box 6490 Cable (lgi) 1 device and 8 entities

Failed setup, will retry: Device not discovered: uuid:75802409-bccb-40e7-9f6c-989BCB6B6D97::urn:schemas-upnp-org:device:InternetGatewayDevice:2

FRITZ!Box 6490 Cable (lgi) 1 device and 8 entities

Failed setup, will retry: Device not discovered: uuid:75802409-bccb-40e7-8e6c-989BCB6B6D97::urn:schemas-upnp-org:device:InternetGatewayDevice:1

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

hegien avatar Oct 04 '24 07:10 hegien

Hey there @stevenlooman, mind taking a look at this issue as it has been labeled with an integration (upnp) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of upnp can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign upnp Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


upnp documentation upnp source (message by IssueLinks)

home-assistant[bot] avatar Oct 04 '24 08:10 home-assistant[bot]

Got same stuff on TPLink router but on 2024.9.3 version

`Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 96, in async_setup_entry
    await device.async_subscribe_services()
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 208, in async_subscribe_services
    await self._igd_device.async_subscribe_services(auto_resubscribe=True)
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/profiles/profile.py", line 355, in async_subscribe_services
    new_sid, timeout = await self._event_handler.async_subscribe(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/event_handler.py", line 208, in async_subscribe
    raise UpnpResponseError(
async_upnp_client.exceptions.UpnpResponseError: Did not receive HTTP 200 but 500`

Deleted the integration and then later a new device was discovered, but setup dont succeed anymore:

Error setting up entry TP-Link SMB ER7206 for upnp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 88, in async_setup_entry
    device = await async_create_device(hass, location, force_poll)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/device.py", line 95, in async_create_device
    upnp_device = await factory.async_create_device(location)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/client_factory.py", line 100, in async_create_device
    root_el = await self._async_get_device_spec(description_url)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/client_factory.py", line 433, in _async_get_device_spec
    bare_response = await self.requester.async_http_request(request)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/aiohttp.py", line 184, in async_http_request
    return await self._async_http_request(http_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_upnp_client/aiohttp.py", line 216, in _async_http_request
    async with self._session.request(
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1353, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 684, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 999, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 640, in read
    await self._waiter
asyncio.exceptions.CancelledError



checkiecheck avatar Oct 08 '24 12:10 checkiecheck

Thank you for creating this issue @hegien. Can you enable debug logging for the upnp component and either post the output here, or mail it to me?

StevenLooman avatar Oct 10 '24 21:10 StevenLooman

@checkiecheck, this seems to be a different problem. Can you create a new issue for this?

StevenLooman avatar Oct 10 '24 21:10 StevenLooman

@StevenLooman I‘ve switched on Debug mode in the Integration pane. But unfortunately I still only get this messsge there: Failed setup, will retry: Device not discovered: uuid:75802409-bccb-40e7-9f6c-989BCB6B6D97::urn:schemas-upnp-org:device:InternetGatewayDevice:2

There is no additional log. I‘m not an HA expert. Do I need to search somewhere else for logs?

hegien avatar Oct 11 '24 16:10 hegien

How long did you wait @hegien after enabling debug logging? It can take some time before upnp tries to (re)initialise.

Also, when you disable the debug logging again, the logs should be automatically downloaded.

StevenLooman avatar Oct 18 '24 19:10 StevenLooman

@checkiecheck, this seems to be a different problem. Can you create a new issue for this?

Seems something is fixed already, integration behaves fine again. Upgrade HA to oktober release did the trick

checkiecheck avatar Oct 19 '24 07:10 checkiecheck

How long did you wait @hegien after enabling debug logging? It can take some time before upnp tries to (re)initialise.

Also, when you disable the debug logging again, the logs should be automatically downloaded.

@StevenLooman Thanks a lot fo your reply. Seems as if I did not wait long enough. I switched on Debug logging this morning. Now I got a logfile, see attached file. home-assistant_upnp_2024-10-19T18-18-28.430Z.log

hegien avatar Oct 19 '24 18:10 hegien

Thank you for the logs. The problem will be fixed with #127006. I expect this to be fixed with the 2024.11 release of Home Assistant.

StevenLooman avatar Oct 21 '24 07:10 StevenLooman

have the same problem with a AVM 6660 which has been updated to Firmware 8 since that time the UPnP dont work FRITZ!Box 6660 Cable von AVM Verbunden über [FritzBox7590-Anbau] Firmware: 8.00

with the 7590 still 7.59 IT WORKS RITZ!Box 7590 von AVM Verbunden über [FRITZ!Box 6660 Cable] Firmware: 7.59

TJHooker avatar Oct 26 '24 06:10 TJHooker

same for me with a netgear router

Crazygiscool avatar Oct 26 '24 20:10 Crazygiscool

Same for me with latest home asssistant release: Core 2024.11.2 Frontend 20241106.2

Registratore: homeassistant.config_entries Fonte: config_entries.py:635 Prima occorrenza: 12:39:14 (4 occorrenze) Ultima registrazione: 12:41:50

Error setting up entry InternetGatewayDeviceV2 - FRITZ!Box 7530 AX for upnp

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 169, in async_setup_entry
    device_entry = dev_registry.async_update_device(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 1030, in async_update_device
    new_values["identifiers"] = self._validate_identifiers(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 1136, in _validate_identifiers
    raise DeviceIdentifierCollisionError(identifiers, existing_device)
homeassistant.helpers.device_registry.DeviceIdentifierCollisionError: Identifiers {
  ('upnp_host', '192.168.178.1'), ('upnp', 'uuid:75802409-bccb-40e7-9f6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:2')
} already registered with DeviceEntry(
  area_id=None,
  config_entries={'5ede965eb356ab431697436207a2f22a'},
  configuration_url=None,
  connections={('upnp', 'uuid:75802409-bccb-40e7-8e6c-485D3539B893')}, 
  created_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc),
  disabled_by=None,
  entry_type=None,
  hw_version=None,
  id='956b43923ac3700abd07643d170d299f',
  identifiers={('upnp_host', '192.168.178.1'), ('upnp', 'uuid:75802409-bccb-40e7-9f6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:2')},
  labels=set(),
  manufacturer='AVM Berlin',
  model='FRITZ!Box 7530 AX',
  model_id=None,
  modified_at=datetime.datetime(2024, 8, 8, 12, 50, 55, 526657,
  tzinfo=datetime.timezone.utc),
  name_by_user=None,
  name='FRITZ!Box 7530 AX',
  primary_config_entry=None,
  serial_number=None,
  suggested_area=None,
  sw_version=None,
  via_device_id=None,
  is_new=False,
  _cache={
    'json_repr': b'{"area_id":null,"configuration_url":null,"config_entries":["5ede965eb356ab431697436207a2f22a"],"connections":[["upnp","uuid:75802409-bccb-40e7-8e6c-485D3539B893"]],"created_at":0.0,"disabled_by":null,"entry_type":null,"hw_version":null,"id":"956b43923ac3700abd07643d170d299f","identifiers":[["upnp_host","192.168.178.1"],["upnp","uuid:75802409-bccb-40e7-9f6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:2"]],"labels":[],"manufacturer":"AVM Berlin","model":"FRITZ!Box 7530 AX","model_id":null,"modified_at":1723121455.526657,"name_by_user":null,"name":"FRITZ!Box 7530 AX","primary_config_entry":null,"serial_number":null,"sw_version":null,"via_device_id":null}'
})

liquidand avatar Nov 20 '24 11:11 liquidand

Did you try removing the integration and creating it again, @liquidand ?

StevenLooman avatar Dec 16 '24 21:12 StevenLooman

Did you try removing the integration and creating it again, @liquidand ?

It works again without any special action. Probably it was solved by one of the last HA updates.

hegien avatar Dec 29 '24 19:12 hegien

Great! I'm closing this issue. If new problems arise, please create a new issue.

StevenLooman avatar Jan 02 '25 19:01 StevenLooman