Migrate foscam to use async_update_entry to alter config entries (#110365)

This commit is contained in:
J. Nick Koston 2024-02-12 12:57:09 -06:00 committed by GitHub
parent e2ec23955e
commit f5497cb0be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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