From f5497cb0be710c6865f101ab9852d98a2c5f0c48 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 12 Feb 2024 12:57:09 -0600 Subject: [PATCH] Migrate foscam to use async_update_entry to alter config entries (#110365) --- homeassistant/components/foscam/__init__.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/foscam/__init__.py b/homeassistant/components/foscam/__init__.py index 057ef4dbe8c..aed3ed637ae 100644 --- a/homeassistant/components/foscam/__init__.py +++ b/homeassistant/components/foscam/__init__.py @@ -66,8 +66,6 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await async_migrate_entries(hass, entry.entry_id, update_unique_id) - entry.unique_id = None - # Get RTSP port from the camera or use the fallback one and store it in data camera = FoscamCamera( entry.data[CONF_HOST], @@ -85,12 +83,12 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: rtsp_port = response.get("rtspPort") or response.get("mediaPort") hass.config_entries.async_update_entry( - entry, data={**entry.data, CONF_RTSP_PORT: rtsp_port} + entry, + data={**entry.data, CONF_RTSP_PORT: rtsp_port}, + version=2, + unique_id=None, ) - # Change entry version - entry.version = 2 - LOGGER.info("Migration to version %s successful", entry.version) return True