From d2663347e900a77970564a9a7092005f7961a189 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 20 Mar 2024 10:36:02 +0100 Subject: [PATCH] Remove Amcrest camera unique id migration (#113870) --- homeassistant/components/amcrest/camera.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/homeassistant/components/amcrest/camera.py b/homeassistant/components/amcrest/camera.py index 3c579e37f8a..1cbf5af4b70 100644 --- a/homeassistant/components/amcrest/camera.py +++ b/homeassistant/components/amcrest/camera.py @@ -13,15 +13,11 @@ from amcrest import AmcrestError from haffmpeg.camera import CameraMjpeg import voluptuous as vol -from homeassistant.components.camera import ( - DOMAIN as CAMERA_DOMAIN, - Camera, - CameraEntityFeature, -) +from homeassistant.components.camera import Camera, CameraEntityFeature from homeassistant.components.ffmpeg import FFmpegManager, get_ffmpeg_manager from homeassistant.const import ATTR_ENTITY_ID, CONF_NAME, STATE_OFF, STATE_ON from homeassistant.core import HomeAssistant -from homeassistant.helpers import config_validation as cv, entity_registry as er +from homeassistant.helpers import config_validation as cv from homeassistant.helpers.aiohttp_client import ( async_aiohttp_proxy_stream, async_aiohttp_proxy_web, @@ -37,7 +33,6 @@ from .const import ( COMM_TIMEOUT, DATA_AMCREST, DEVICES, - DOMAIN, RESOLUTION_TO_STREAM, SERVICE_UPDATE, SNAPSHOT_TIMEOUT, @@ -141,18 +136,6 @@ async def async_setup_platform( device = hass.data[DATA_AMCREST][DEVICES][name] entity = AmcrestCam(name, device, get_ffmpeg_manager(hass)) - # 2021.9.0 introduced unique id's for the camera entity, but these were not - # unique for different resolution streams. If any cameras were configured - # with this version, update the old entity with the new unique id. - serial_number = await device.api.async_serial_number - serial_number = serial_number.strip() - registry = er.async_get(hass) - entity_id = registry.async_get_entity_id(CAMERA_DOMAIN, DOMAIN, serial_number) - if entity_id is not None: - _LOGGER.debug("Updating unique id for camera %s", entity_id) - new_unique_id = f"{serial_number}-{device.resolution}-{device.channel}" - registry.async_update_entity(entity_id, new_unique_id=new_unique_id) - async_add_entities([entity], True)