mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 14:29:21 -04:00
Update options last
This commit is contained in:
@@ -156,11 +156,6 @@ async def async_clean_import(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
entities = er.async_entries_for_config_entry(entity_reg, old_config_entry_id)
|
||||
old_entity_entry = entities[0] if entities else None
|
||||
|
||||
# Update options to not run migration again
|
||||
new_options = dict(entry.options)
|
||||
new_options.pop("old_config_entry_id")
|
||||
hass.config_entries.async_update_entry(entry, options=new_options)
|
||||
|
||||
if not old_config_entry or not old_entity_entry:
|
||||
# User has manually removed the entry or entity before we came here
|
||||
# Skip the migration and just continue with setting up the group sensor
|
||||
@@ -188,6 +183,11 @@ async def async_clean_import(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
) from err
|
||||
await hass.config_entries.async_remove(old_entity_entry.config_entry_id)
|
||||
|
||||
# Update options to not run migration again
|
||||
new_options = dict(entry.options)
|
||||
new_options.pop("old_config_entry_id")
|
||||
hass.config_entries.async_update_entry(entry, options=new_options)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up a config entry."""
|
||||
|
||||
Reference in New Issue
Block a user