From f504ac8c65b63bc93dae2b721919c7e489d3272b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 25 Nov 2019 17:06:10 +0200 Subject: [PATCH] Drop < 0.97 Huawei LTE sensor unique id migration workaround (#29060) --- homeassistant/components/huawei_lte/sensor.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/homeassistant/components/huawei_lte/sensor.py b/homeassistant/components/huawei_lte/sensor.py index 99170d4e7c0..3cc36b30d8e 100644 --- a/homeassistant/components/huawei_lte/sensor.py +++ b/homeassistant/components/huawei_lte/sensor.py @@ -11,7 +11,6 @@ from homeassistant.components.sensor import ( DEVICE_CLASS_SIGNAL_STRENGTH, DOMAIN as SENSOR_DOMAIN, ) -from homeassistant.helpers import entity_registry from . import HuaweiLteBaseEntity from .const import ( @@ -170,23 +169,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities): HuaweiLteSensor(router, key, item, SENSOR_META.get((key, item), {})) ) - # Pre-0.97 unique id migration. Old ones used the device serial number - # (see comments in HuaweiLteData._setup_lte for more info), as well as - # had a bug that joined the path str with periods, not the path components, - # resulting e.g. *_device_signal.sinr to end up as - # *_d.e.v.i.c.e._.s.i.g.n.a.l...s.i.n.r - entreg = await entity_registry.async_get_registry(hass) - for entid, ent in entreg.entities.items(): - if ent.platform != DOMAIN: - continue - for sensor in sensors: - oldsuf = ".".join(f"{sensor.key}.{sensor.item}") - if ent.unique_id.endswith(f"_{oldsuf}"): - entreg.async_update_entity(entid, new_unique_id=sensor.unique_id) - _LOGGER.debug( - "Updated entity %s unique id to %s", entid, sensor.unique_id - ) - async_add_entities(sensors, True)