mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Update airvisual to set ConfigEntry version with async_update_entry (#110204)
* Update airvisual to set ConfigEntry version with async_update_entry * Update airvisual to set ConfigEntry version with async_update_entry
This commit is contained in:
parent
b3e46e3d64
commit
1e7cd7c0c6
@ -242,7 +242,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
# 1 -> 2: One geography per config entry
|
||||
if version == 1:
|
||||
version = entry.version = 2
|
||||
version = 2
|
||||
|
||||
# Update the config entry to only include the first geography (there is always
|
||||
# guaranteed to be at least one):
|
||||
@ -255,6 +255,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
unique_id=first_id,
|
||||
title=f"Cloud API ({first_id})",
|
||||
data={CONF_API_KEY: entry.data[CONF_API_KEY], **first_geography},
|
||||
version=version,
|
||||
)
|
||||
|
||||
# For any geographies that remain, create a new config entry for each one:
|
||||
@ -379,7 +380,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
},
|
||||
)
|
||||
else:
|
||||
entry.version = version
|
||||
hass.config_entries.async_update_entry(entry, version=version)
|
||||
|
||||
LOGGER.info("Migration to version %s successful", version)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user