diff --git a/custom_components/family_safety/config_flow.py b/custom_components/family_safety/config_flow.py index 176bade..dbe1c35 100644 --- a/custom_components/family_safety/config_flow.py +++ b/custom_components/family_safety/config_flow.py @@ -195,9 +195,7 @@ async def async_step_applications( ) default_tracked_applications = [] - tracked_applications = self.config_entry.data.get("tracked_applications", []) - if self.config_entry.options: - tracked_applications = self.config_entry.options.get("tracked_applications", []) + tracked_applications = self._get_config_entry("tracked_applications") if tracked_applications is None: tracked_applications = [] for app in tracked_applications: @@ -240,11 +238,9 @@ async def async_step_accounts( ) default_tracked_accounts = [] - tracked_accounts = self.config_entry.data.get("accounts", []) + tracked_accounts = self._get_config_entry("accounts") if tracked_accounts is None: tracked_accounts = [] - if self.config_entry.options: - tracked_accounts = self.config_entry.options.get("accounts", []) for account in tracked_accounts: try: acc = self.family_safety.get_account(account) diff --git a/custom_components/family_safety/switch.py b/custom_components/family_safety/switch.py index 1af9cee..0bbfe94 100644 --- a/custom_components/family_safety/switch.py +++ b/custom_components/family_safety/switch.py @@ -30,7 +30,8 @@ async def async_setup_entry( accounts: list[Account] = hass.data[DOMAIN][config_entry.entry_id].api.accounts entities = [] for account in accounts: - if (account.user_id in config_entry.options.get("accounts", [])) or ( + if (config_entry.options.get("accounts", None) is None) or ( + account.user_id in config_entry.options.get("accounts", [])) or ( len(config_entry.options.get("accounts", []))==0 ): for platform in DEFAULT_OVERRIDE_ENTITIES: