error is
error Log details (ERROR)
Logger: homeassistant.config_entries
Source: config_entries.py:787
First occurred: xxxx at xxxx (3 occurrences)
Last logged: xxxx at xxxx AM
Error setting up entry xxxxxx-6d72-4e09-83fe-997beacbd137 for postnl
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 787, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/postnl/__init__.py", line 80, in async_setup_entry
entity_registry.async_update_entity(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
entity_id=entity_entry.entity_id, new_unique_id=entity_new_unique_id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1890, in async_update_entity
return self._async_update_entity(
~~~~~~~~~~~~~~~~~~~~~~~~~^
entity_id,
^^^^^^^^^^
...<22 lines>...
unit_of_measurement=unit_of_measurement,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1806, in _async_update_entity
raise ValueError(
...<2 lines>...
)
ValueError: Unique id 'c477f4fd-e684-4f99-b6c5-13dc80f3fa10_01KDTMT0NKBQXP5T33H3DP9B85' is already in use by 'sensor.postnl_trend_2'
consulting with copilot , here is the fix "it worked for me"
Replace this block:
entity_registry.async_update_entity(
entity_id=entity_entry.entity_id,
new_unique_id=entity_new_unique_id
)
with
existing_entity = entity_registry.async_get_entity_id(
entity_entry.domain,
entity_entry.platform,
entity_new_unique_id,
)
if existing_entity:
_LOGGER.warning(
"Skipping migration for %s → %s (already exists as %s)",
entity_entry.unique_id,
entity_new_unique_id,
existing_entity,
)
continue
try:
entity_registry.async_update_entity(
entity_id=entity_entry.entity_id,
new_unique_id=entity_new_unique_id,
)
except ValueError as err:
_LOGGER.warning(
"Failed to migrate entity %s: %s",
entity_entry.entity_id,
err,
)
error is
error Log details (ERROR)
consulting with copilot , here is the fix "it worked for me"
Replace this block:
with