home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.11k stars 29.79k forks source link

UPNP/IGD configuration unsuccessful. #123371

Open liquidand opened 1 month ago

liquidand commented 1 month ago

The problem

UPNP configuration unsuccessful.

What version of Home Assistant Core has the issue?

2024.8.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

UPNP/IGD

Link to integration documentation on our website

https://www.home-assistant.io/integrations/upnp

Diagnostics information

home-assistant_upnp_2024-08-08T12-43-45.435Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Registratore: homeassistant.config_entries
Fonte: config_entries.py:604
Prima occorrenza: 14:32:40 (3 occorrenze)
Ultima registrazione: 14:43:43

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 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/upnp/__init__.py", line 170, in async_setup_entry
    device_entry = dev_registry.async_update_device(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 1027, in async_update_device
    new_values["identifiers"] = self._validate_identifiers(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 1133, in _validate_identifiers
    raise DeviceIdentifierCollisionError(identifiers, existing_device)
homeassistant.helpers.device_registry.DeviceIdentifierCollisionError: Identifiers {('upnp', 'uuid:75802409-bccb-40e7-9f6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:2'), ('upnp_host', '192.168.178.1')} already registered with DeviceEntry(area_id=None, config_entries={'5ede965eb356ab431697436207a2f22a', '2293089b3a0b3f2355474dc46d98a28c', '96f536f9906440512c29097957dbe6fd'}, configuration_url='http://192.168.178.1', connections={('mac', '48:5d:35:39:b8:93')}, created_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), disabled_by=None, entry_type=None, hw_version=None, id='48499c59a42d4aec7a3b40c2f50ba30f', identifiers={('upnp_host', '192.168.178.1'), ('upnp', 'uuid:75802409-bccb-40e7-8e6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:1')}, labels=set(), manufacturer='AVM', model='FRITZ!Box 7530 AX', model_id=None, modified_at=datetime.datetime(2024, 8, 8, 12, 32, 40, 740117, tzinfo=datetime.timezone.utc), name_by_user=None, name='FRITZ!Box 7530 AX', primary_config_entry='96f536f9906440512c29097957dbe6fd', serial_number=None, suggested_area=None, sw_version='7.81', via_device_id=None, is_new=False)

Additional information

No response

home-assistant[bot] commented 1 month ago

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)

StevenLooman commented 4 weeks ago

Hi @liquidand. Thank you for this issue and adding the logs. In the logging I see the existing DeviceEntry:

DeviceEntry(
    area_id=None,
    config_entries={
        '5ede965eb356ab431697436207a2f22a',
        '2293089b3a0b3f2355474dc46d98a28c',
        '96f536f9906440512c29097957dbe6fd'
    },
    configuration_url='http://192.168.178.1',
    connections={
        ('mac', '48:5d:35:39:b8:93')
    },
    created_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc),
    disabled_by=None,
    entry_type=None,
    hw_version=None,
    id='48499c59a42d4aec7a3b40c2f50ba30f',
    identifiers={
        ('upnp_host', '192.168.178.1'),
        ('upnp', 'uuid:75802409-bccb-40e7-8e6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:1')
    },
    labels=set(),
    manufacturer='AVM',
    model='FRITZ!Box 7530 AX',
    model_id=None,
    modified_at=datetime.datetime(2024, 8, 8, 12, 32, 40, 740117, tzinfo=datetime.timezone.utc),
    name_by_user=None,
    name='FRITZ!Box 7530 AX',
    primary_config_entry='96f536f9906440512c29097957dbe6fd',
    serial_number=None,
    suggested_area=None,
    sw_version='7.81',
    via_device_id=None,
    is_new=False)

Note the upnp-identifier: uuid:75802409-bccb-40e7-8e6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:1 (InternetGatewayDevice:1 specifically).

The found device has identifiers:

Identifiers {
  ('upnp', 'uuid:75802409-bccb-40e7-9f6c-485D3539B893::urn:schemas-upnp-org:device:InternetGatewayDevice:2'),
  ('upnp_host', '192.168.178.1')}

Note the InternetGatewayDevice:2.

Looking at the changelog for the FRITZ!Box 7530 AX I do see IGD has changed in version 07.50, although little information is given.

My guess is that the router first identified itself as InternetGatewayDevice:1. The device was added to Home Assistant. Then the device got an update, and started itself identifying as InternetGatewayDevice:2. Now Home Assistant is confused. Although I am uncertain about the timelines of the updates, so this is a bit of a guess.

Can you try removing the integration and adding it again? Hopefully the registration of the device (i.e., DeviceEntry) is removed automatically as well.

wora55 commented 2 weeks ago

Removing the devices and adding them again worked for me. (or at least I got rid of the error messages)