diff --git a/homeassistant/components/deconz/number.py b/homeassistant/components/deconz/number.py index a829831b511..6464a99fd7a 100644 --- a/homeassistant/components/deconz/number.py +++ b/homeassistant/components/deconz/number.py @@ -21,12 +21,9 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import EntityCategory from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback -import homeassistant.helpers.entity_registry as er -from .const import DOMAIN as DECONZ_DOMAIN from .deconz_device import DeconzDevice from .hub import DeconzHub, get_gateway_from_config_entry -from .util import serial_from_unique_id T = TypeVar("T", Presence, PydeconzSensorBase) @@ -70,25 +67,6 @@ ENTITY_DESCRIPTIONS: tuple[DeconzNumberDescription, ...] = ( ) -@callback -def async_update_unique_id( - hass: HomeAssistant, unique_id: str, description: DeconzNumberDescription -) -> None: - """Update unique ID base to be on full unique ID rather than device serial. - - Introduced with release 2022.11. - """ - ent_reg = er.async_get(hass) - - new_unique_id = f"{unique_id}-{description.key}" - if ent_reg.async_get_entity_id(DOMAIN, DECONZ_DOMAIN, new_unique_id): - return - - unique_id = f"{serial_from_unique_id(unique_id)}-{description.key}" - if entity_id := ent_reg.async_get_entity_id(DOMAIN, DECONZ_DOMAIN, unique_id): - ent_reg.async_update_entity(entity_id, new_unique_id=new_unique_id) - - async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, @@ -109,8 +87,6 @@ async def async_setup_entry( or description.value_fn(sensor) is None ): continue - if description.key == "delay": - async_update_unique_id(hass, sensor.unique_id, description) async_add_entities([DeconzNumber(sensor, gateway, description)]) gateway.register_platform_add_device_callback( diff --git a/tests/components/deconz/test_number.py b/tests/components/deconz/test_number.py index 19d1cdf2bea..3f86182e032 100644 --- a/tests/components/deconz/test_number.py +++ b/tests/components/deconz/test_number.py @@ -4,7 +4,6 @@ from unittest.mock import patch import pytest -from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN from homeassistant.components.number import ( ATTR_VALUE, DOMAIN as NUMBER_DOMAIN, @@ -50,7 +49,6 @@ TEST_DATA = [ "device_count": 3, "entity_id": "number.presence_sensor_delay", "unique_id": "00:00:00:00:00:00:00:00-00-delay", - "old_unique_id": "00:00:00:00:00:00:00:00-delay", "state": "0", "entity_category": EntityCategory.CONFIG, "attributes": { @@ -120,15 +118,6 @@ async def test_number_entities( ) -> None: """Test successful creation of number entities.""" - # Create entity entry to migrate to new unique ID - if "old_unique_id" in expected: - entity_registry.async_get_or_create( - NUMBER_DOMAIN, - DECONZ_DOMAIN, - expected["old_unique_id"], - suggested_object_id=expected["entity_id"].replace("number.", ""), - ) - with patch.dict(DECONZ_WEB_REQUEST, {"sensors": {"0": sensor_data}}): config_entry = await setup_deconz_integration(hass, aioclient_mock)