mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 17:18:23 +00:00
Fix Verisure config entry migration (#98546)
This commit is contained in:
parent
fde498586e
commit
6faa9abc75
@ -83,7 +83,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
LOGGER.debug("Migrating from version %s", entry.version)
|
LOGGER.debug("Migrating from version %s", entry.version)
|
||||||
|
|
||||||
if entry.version == 1:
|
if entry.version == 1:
|
||||||
config_entry_default_code = entry.options.get(CONF_LOCK_DEFAULT_CODE)
|
if config_entry_default_code := entry.options.get(CONF_LOCK_DEFAULT_CODE):
|
||||||
entity_reg = er.async_get(hass)
|
entity_reg = er.async_get(hass)
|
||||||
entries = er.async_entries_for_config_entry(entity_reg, entry.entry_id)
|
entries = er.async_entries_for_config_entry(entity_reg, entry.entry_id)
|
||||||
for entity in entries:
|
for entity in entries:
|
||||||
@ -96,9 +96,10 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
new_options = entry.options.copy()
|
new_options = entry.options.copy()
|
||||||
del new_options[CONF_LOCK_DEFAULT_CODE]
|
del new_options[CONF_LOCK_DEFAULT_CODE]
|
||||||
|
|
||||||
entry.version = 2
|
|
||||||
hass.config_entries.async_update_entry(entry, options=new_options)
|
hass.config_entries.async_update_entry(entry, options=new_options)
|
||||||
|
|
||||||
|
entry.version = 2
|
||||||
|
|
||||||
LOGGER.info("Migration to version %s successful", entry.version)
|
LOGGER.info("Migration to version %s successful", entry.version)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user