Migrate foscam to use async_update_entry to alter config entries (#110365)
This commit is contained in:
parent
e2ec23955e
commit
f5497cb0be
1 changed files with 4 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue