diff --git a/custom_components/mega/__init__.py b/custom_components/mega/__init__.py index 88960de..b9d10d1 100644 --- a/custom_components/mega/__init__.py +++ b/custom_components/mega/__init__.py @@ -254,10 +254,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): _hubs[entry.entry_id] = hub _subs[entry.entry_id] = entry.add_update_listener(updater) await hub.start() - for platform in PLATFORMS: - hass.async_create_task( - hass.config_entries.async_forward_entry_setup(entry, platform) - ) + # for platform in PLATFORMS: + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) await hub.updater.async_refresh() return True @@ -314,8 +312,7 @@ async def async_migrate_entry(hass, config_entry: ConfigEntry): await hub.stop() new.update(cfg) _LOGGER.debug(f"new config: %s", new) - config_entry.data = new - config_entry.version = ConfigFlow.VERSION + hass.config_entries.async_update_entry(config_entry, data=new, version=ConfigFlow.VERSION) _LOGGER.info("Migration to version %s successful", config_entry.version) diff --git a/custom_components/mega/config_flow.py b/custom_components/mega/config_flow.py index 8816ba8..efc597f 100644 --- a/custom_components/mega/config_flow.py +++ b/custom_components/mega/config_flow.py @@ -130,7 +130,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow): cfg = dict(self.config_entry.data) cfg.update(user_input) 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) if reload: