Skip to content

Commit

Permalink
1.1.0b3
Browse files Browse the repository at this point in the history
fix optionsflow updating incorrect value
  • Loading branch information
pantherale0 committed Sep 20, 2023
1 parent 04645b9 commit cd7edb3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion custom_components/family_safety/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def update_listener(hass: HomeAssistant, entry: ConfigEntry):
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
_LOGGER.debug("Unloading config entry %s", entry.entry_id)
hass.data[DOMAIN][entry.entry_id].api.api.end_session()
await hass.data[DOMAIN][entry.entry_id].api.api.end_session()
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)

Expand Down
12 changes: 7 additions & 5 deletions custom_components/family_safety/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ async def _async_create_entry(self, **kwargs) -> config_entries.FlowResult:
update_interval = self._get_config_entry("update_interval")
if kwargs.get("update_interval", None) is not None:
update_interval = kwargs.get("update_interval")
if update_interval is None:
update_interval = 60

refresh_token = self._get_config_entry("refresh_token")
if kwargs.get("refresh_token", None) is not None:
update_interval = kwargs.get("refresh_token")
refresh_token = kwargs.get("refresh_token")

tracked_applications = self._get_config_entry("tracked_applications")
if kwargs.get("tracked_applications", None) is not None:
Expand Down Expand Up @@ -162,7 +164,7 @@ async def async_step_auth(

update_interval = self.config_entry.data["update_interval"]
if self.config_entry.options:
update_interval = self.config_entry.options.get("update_interval")
update_interval = self.config_entry.options.get("update_interval", update_interval)

return self.async_show_form(
step_id="auth",
Expand All @@ -180,12 +182,12 @@ async def async_step_applications(
) -> config_entries.FlowResult:
"""Application configuration step."""
if user_input is not None:
tracked_application_ids = []
tracked_applications = []
applications = self.family_safety.accounts[0].applications
for app in user_input.get("tracked_applications", []):
tracked_application_ids.append(_get_application_id(app, applications))
tracked_applications.append(_get_application_id(app, applications))
return await self._async_create_entry(
tracked_application_ids=tracked_application_ids
tracked_applications=tracked_applications
)

default_tracked_applications = []
Expand Down
2 changes: 1 addition & 1 deletion custom_components/family_safety/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

NAME = "Microsoft Family Safety"
DOMAIN = "family_safety"
VERSION = "1.1.0b2"
VERSION = "1.1.0b3"

DEFAULT_OVERRIDE_ENTITIES = [OverrideTarget.MOBILE,
OverrideTarget.WINDOWS,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/family_safety/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"requirements": ["pyfamilysafety==0.1.1"],
"ssdp": [],
"zeroconf": [],
"version": "1.1.0b2",
"version": "1.1.0b3",
"integration_type": "service"
}

0 comments on commit cd7edb3

Please sign in to comment.