mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-13 18:14:28 +05:00
fix config migration
This commit is contained in:
@@ -254,10 +254,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|||||||
_hubs[entry.entry_id] = hub
|
_hubs[entry.entry_id] = hub
|
||||||
_subs[entry.entry_id] = entry.add_update_listener(updater)
|
_subs[entry.entry_id] = entry.add_update_listener(updater)
|
||||||
await hub.start()
|
await hub.start()
|
||||||
for platform in PLATFORMS:
|
# for platform in PLATFORMS:
|
||||||
hass.async_create_task(
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
hass.config_entries.async_forward_entry_setup(entry, platform)
|
|
||||||
)
|
|
||||||
await hub.updater.async_refresh()
|
await hub.updater.async_refresh()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -314,8 +312,7 @@ async def async_migrate_entry(hass, config_entry: ConfigEntry):
|
|||||||
await hub.stop()
|
await hub.stop()
|
||||||
new.update(cfg)
|
new.update(cfg)
|
||||||
_LOGGER.debug(f"new config: %s", new)
|
_LOGGER.debug(f"new config: %s", new)
|
||||||
config_entry.data = new
|
hass.config_entries.async_update_entry(config_entry, data=new, version=ConfigFlow.VERSION)
|
||||||
config_entry.version = ConfigFlow.VERSION
|
|
||||||
|
|
||||||
_LOGGER.info("Migration to version %s successful", config_entry.version)
|
_LOGGER.info("Migration to version %s successful", config_entry.version)
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
cfg = dict(self.config_entry.data)
|
cfg = dict(self.config_entry.data)
|
||||||
cfg.update(user_input)
|
cfg.update(user_input)
|
||||||
cfg["new_naming"] = new_naming
|
cfg["new_naming"] = new_naming
|
||||||
self.config_entry.data = cfg
|
self.hass.config_entries.async_update_entry(entry=self.config_entry, data=cfg)
|
||||||
await get_hub(self.hass, cfg)
|
await get_hub(self.hass, cfg)
|
||||||
|
|
||||||
if reload:
|
if reload:
|
||||||
|
|||||||
Reference in New Issue
Block a user