diff --git a/homeassistant/components/isy994/binary_sensor.py b/homeassistant/components/isy994/binary_sensor.py index da12ebd3ef8..828688c3429 100644 --- a/homeassistant/components/isy994/binary_sensor.py +++ b/homeassistant/components/isy994/binary_sensor.py @@ -45,7 +45,6 @@ from .const import ( TYPE_INSTEON_MOTION, ) from .entity import ISYNodeEntity, ISYProgramEntity -from .helpers import migrate_old_unique_ids DEVICE_PARENT_REQUIRED = [ BinarySensorDeviceClass.OPENING, @@ -191,7 +190,6 @@ async def async_setup_entry( for name, status, _ in hass_isy_data[ISY994_PROGRAMS][Platform.BINARY_SENSOR]: entities.append(ISYBinarySensorProgramEntity(name, status)) - await migrate_old_unique_ids(hass, Platform.BINARY_SENSOR, entities) async_add_entities(entities) diff --git a/homeassistant/components/isy994/climate.py b/homeassistant/components/isy994/climate.py index 44d64c05be7..612d411245f 100644 --- a/homeassistant/components/isy994/climate.py +++ b/homeassistant/components/isy994/climate.py @@ -54,7 +54,7 @@ from .const import ( UOM_TO_STATES, ) from .entity import ISYNodeEntity -from .helpers import convert_isy_value_to_hass, migrate_old_unique_ids +from .helpers import convert_isy_value_to_hass async def async_setup_entry( @@ -67,7 +67,6 @@ async def async_setup_entry( for node in hass_isy_data[ISY994_NODES][Platform.CLIMATE]: entities.append(ISYThermostatEntity(node)) - await migrate_old_unique_ids(hass, Platform.CLIMATE, entities) async_add_entities(entities) diff --git a/homeassistant/components/isy994/cover.py b/homeassistant/components/isy994/cover.py index e7d3349958c..de97581dfef 100644 --- a/homeassistant/components/isy994/cover.py +++ b/homeassistant/components/isy994/cover.py @@ -24,7 +24,6 @@ from .const import ( UOM_BARRIER, ) from .entity import ISYNodeEntity, ISYProgramEntity -from .helpers import migrate_old_unique_ids async def async_setup_entry( @@ -39,7 +38,6 @@ async def async_setup_entry( for name, status, actions in hass_isy_data[ISY994_PROGRAMS][Platform.COVER]: entities.append(ISYCoverProgramEntity(name, status, actions)) - await migrate_old_unique_ids(hass, Platform.COVER, entities) async_add_entities(entities) diff --git a/homeassistant/components/isy994/entity.py b/homeassistant/components/isy994/entity.py index 144ec016d22..1dc60ef9664 100644 --- a/homeassistant/components/isy994/entity.py +++ b/homeassistant/components/isy994/entity.py @@ -1,7 +1,7 @@ """Representation of ISYEntity Types.""" from __future__ import annotations -from typing import Any, cast +from typing import Any from pyisy.constants import ( COMMAND_FRIENDLY_NAME, @@ -130,13 +130,6 @@ class ISYEntity(Entity): return f"{self._node.isy.configuration[ISY_CONF_UUID]}_{self._node.address}" return None - @property - def old_unique_id(self) -> str | None: - """Get the old unique identifier of the device.""" - if hasattr(self._node, "address"): - return cast(str, self._node.address) - return None - @property def name(self) -> str: """Get the name of the device.""" diff --git a/homeassistant/components/isy994/fan.py b/homeassistant/components/isy994/fan.py index 5fd14927322..1ff7d9f7961 100644 --- a/homeassistant/components/isy994/fan.py +++ b/homeassistant/components/isy994/fan.py @@ -19,7 +19,6 @@ from homeassistant.util.percentage import ( from .const import _LOGGER, DOMAIN as ISY994_DOMAIN, ISY994_NODES, ISY994_PROGRAMS from .entity import ISYNodeEntity, ISYProgramEntity -from .helpers import migrate_old_unique_ids SPEED_RANGE = (1, 255) # off is not included @@ -37,7 +36,6 @@ async def async_setup_entry( for name, status, actions in hass_isy_data[ISY994_PROGRAMS][Platform.FAN]: entities.append(ISYFanProgramEntity(name, status, actions)) - await migrate_old_unique_ids(hass, Platform.FAN, entities) async_add_entities(entities) diff --git a/homeassistant/components/isy994/helpers.py b/homeassistant/components/isy994/helpers.py index cc602a49777..42c0c60120f 100644 --- a/homeassistant/components/isy994/helpers.py +++ b/homeassistant/components/isy994/helpers.py @@ -1,8 +1,7 @@ """Sorting helpers for ISY device classifications.""" from __future__ import annotations -from collections.abc import Sequence -from typing import TYPE_CHECKING, cast +from typing import cast from pyisy.constants import ( ISY_VALUE_UNKNOWN, @@ -17,13 +16,10 @@ from pyisy.programs import Programs from pyisy.variables import Variables from homeassistant.const import Platform -from homeassistant.core import HomeAssistant -from homeassistant.helpers import entity_registry as er from .const import ( _LOGGER, DEFAULT_PROGRAM_STRING, - DOMAIN, FILTER_INSTEON_TYPE, FILTER_NODE_DEF_ID, FILTER_STATES, @@ -50,9 +46,6 @@ from .const import ( UOM_ISYV4_DEGREES, ) -if TYPE_CHECKING: - from .entity import ISYEntity - BINARY_SENSOR_UOMS = ["2", "78"] BINARY_SENSOR_ISY_STATES = ["on", "off"] @@ -381,40 +374,6 @@ def _categorize_variables( variable_entities[Platform.SENSOR].append((vname, variables[vtype][vid])) -async def migrate_old_unique_ids( - hass: HomeAssistant, platform: str, entities: Sequence[ISYEntity] -) -> None: - """Migrate to new controller-specific unique ids.""" - registry = er.async_get(hass) - - for entity in entities: - if entity.old_unique_id is None or entity.unique_id is None: - continue - old_entity_id = registry.async_get_entity_id( - platform, DOMAIN, entity.old_unique_id - ) - if old_entity_id is not None: - _LOGGER.debug( - "Migrating unique_id from [%s] to [%s]", - entity.old_unique_id, - entity.unique_id, - ) - registry.async_update_entity(old_entity_id, new_unique_id=entity.unique_id) - - old_entity_id_2 = registry.async_get_entity_id( - platform, DOMAIN, entity.unique_id.replace(":", "") - ) - if old_entity_id_2 is not None: - _LOGGER.debug( - "Migrating unique_id from [%s] to [%s]", - entity.unique_id.replace(":", ""), - entity.unique_id, - ) - registry.async_update_entity( - old_entity_id_2, new_unique_id=entity.unique_id - ) - - def convert_isy_value_to_hass( value: int | float | None, uom: str | None, diff --git a/homeassistant/components/isy994/light.py b/homeassistant/components/isy994/light.py index 92cfb452969..ed13b8c94f4 100644 --- a/homeassistant/components/isy994/light.py +++ b/homeassistant/components/isy994/light.py @@ -22,7 +22,6 @@ from .const import ( UOM_PERCENTAGE, ) from .entity import ISYNodeEntity -from .helpers import migrate_old_unique_ids from .services import async_setup_light_services ATTR_LAST_BRIGHTNESS = "last_brightness" @@ -40,7 +39,6 @@ async def async_setup_entry( for node in hass_isy_data[ISY994_NODES][Platform.LIGHT]: entities.append(ISYLightEntity(node, restore_light_state)) - await migrate_old_unique_ids(hass, Platform.LIGHT, entities) async_add_entities(entities) async_setup_light_services(hass) diff --git a/homeassistant/components/isy994/lock.py b/homeassistant/components/isy994/lock.py index 1101eebd632..8fa271a50d0 100644 --- a/homeassistant/components/isy994/lock.py +++ b/homeassistant/components/isy994/lock.py @@ -13,7 +13,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import _LOGGER, DOMAIN as ISY994_DOMAIN, ISY994_NODES, ISY994_PROGRAMS from .entity import ISYNodeEntity, ISYProgramEntity -from .helpers import migrate_old_unique_ids VALUE_TO_STATE = {0: False, 100: True} @@ -30,7 +29,6 @@ async def async_setup_entry( for name, status, actions in hass_isy_data[ISY994_PROGRAMS][Platform.LOCK]: entities.append(ISYLockProgramEntity(name, status, actions)) - await migrate_old_unique_ids(hass, Platform.LOCK, entities) async_add_entities(entities) diff --git a/homeassistant/components/isy994/sensor.py b/homeassistant/components/isy994/sensor.py index e3e812d1b26..635b456da25 100644 --- a/homeassistant/components/isy994/sensor.py +++ b/homeassistant/components/isy994/sensor.py @@ -45,7 +45,7 @@ from .const import ( UOM_TO_STATES, ) from .entity import ISYEntity, ISYNodeEntity -from .helpers import convert_isy_value_to_hass, migrate_old_unique_ids +from .helpers import convert_isy_value_to_hass # Disable general purpose and redundant sensors by default AUX_DISABLED_BY_DEFAULT_MATCH = ["GV", "DO"] @@ -135,7 +135,6 @@ async def async_setup_entry( for vname, vobj in hass_isy_data[ISY994_VARIABLES][Platform.SENSOR]: entities.append(ISYSensorVariableEntity(vname, vobj)) - await migrate_old_unique_ids(hass, Platform.SENSOR, entities) async_add_entities(entities) diff --git a/homeassistant/components/isy994/switch.py b/homeassistant/components/isy994/switch.py index a637f4f632a..10c23c3c434 100644 --- a/homeassistant/components/isy994/switch.py +++ b/homeassistant/components/isy994/switch.py @@ -13,7 +13,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import _LOGGER, DOMAIN as ISY994_DOMAIN, ISY994_NODES, ISY994_PROGRAMS from .entity import ISYNodeEntity, ISYProgramEntity -from .helpers import migrate_old_unique_ids async def async_setup_entry( @@ -28,7 +27,6 @@ async def async_setup_entry( for name, status, actions in hass_isy_data[ISY994_PROGRAMS][Platform.SWITCH]: entities.append(ISYSwitchProgramEntity(name, status, actions)) - await migrate_old_unique_ids(hass, Platform.SWITCH, entities) async_add_entities(entities)