From cc5c8cab142af6e09f95079f6bf0739c25738aaa Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:47:03 -0700 Subject: [PATCH 1/5] Update config_flow.py Fix typo in @callback: `in_progess_instances` -> `in_progress_instances` --- custom_components/alexa_media/config_flow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index 98d2b879..877624e4 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -84,7 +84,7 @@ def configured_instances(hass): @callback -def in_progess_instances(hass): +def in_progress_instances(hass): """Return a set of in progress Alexa Media flows.""" return {entry["flow_id"] for entry in hass.config_entries.flow.async_progress()} From a22fe3d93626ccad5bdc76a32ff4eb2ec12dd157 Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Wed, 18 Sep 2024 00:07:42 -0700 Subject: [PATCH 2/5] Update __init__.py Changed: 'from .config_flow import in_progess_instances' to: 'from .config_flow import in_progress_instances' There are no other references in this file, or any other file. --- custom_components/alexa_media/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/alexa_media/__init__.py b/custom_components/alexa_media/__init__.py index 3dca0bf7..a77a871d 100644 --- a/custom_components/alexa_media/__init__.py +++ b/custom_components/alexa_media/__init__.py @@ -54,7 +54,7 @@ import voluptuous as vol from .alexa_entity import AlexaEntityData, get_entity_data, parse_alexa_entities -from .config_flow import in_progess_instances +from .config_flow import in_progress_instances from .const import ( ALEXA_COMPONENTS, CONF_ACCOUNTS, From 7585792705500c732045f85718b5635cce1fbe05 Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Wed, 18 Sep 2024 00:16:25 -0700 Subject: [PATCH 3/5] Update config_flow.py @callback def in_progress_instances(hass): """Return a set of in-progress Alexa Media flows.""" return { entry["flow_id"] for entry in hass.config_entries.flow.async_progress() if entry["handler"] == DOMAIN # Ensure only Alexa Media flows are included } --- custom_components/alexa_media/config_flow.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index 877624e4..a3cb72c6 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -85,9 +85,12 @@ def configured_instances(hass): @callback def in_progress_instances(hass): - """Return a set of in progress Alexa Media flows.""" - return {entry["flow_id"] for entry in hass.config_entries.flow.async_progress()} - + """Return a set of in-progress Alexa Media flows.""" + return { + entry["flow_id"] + for entry in hass.config_entries.flow.async_progress() + if entry["handler"] == DOMAIN # Ensure only Alexa Media flows are included + } @config_entries.HANDLERS.register(DOMAIN) class AlexaMediaFlowHandler(config_entries.ConfigFlow): From 9d4ec34e23e74ba621d045190e98d39981354948 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 07:16:35 +0000 Subject: [PATCH 4/5] style: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- custom_components/alexa_media/config_flow.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index a3cb72c6..a026c163 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -92,6 +92,7 @@ def in_progress_instances(hass): if entry["handler"] == DOMAIN # Ensure only Alexa Media flows are included } + @config_entries.HANDLERS.register(DOMAIN) class AlexaMediaFlowHandler(config_entries.ConfigFlow): """Handle a Alexa Media config flow.""" From 8c8585f7a1038b530e6bbac2bf1c7b3309fd093d Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Wed, 18 Sep 2024 01:12:15 -0700 Subject: [PATCH 5/5] Update __init__.py --- custom_components/alexa_media/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/alexa_media/__init__.py b/custom_components/alexa_media/__init__.py index a77a871d..d561e3c5 100644 --- a/custom_components/alexa_media/__init__.py +++ b/custom_components/alexa_media/__init__.py @@ -1451,7 +1451,7 @@ async def test_login_status(hass, config_entry, login) -> bool: if login.status and login.status.get("login_successful"): return True account = config_entry.data - _LOGGER.debug("Logging in: %s %s", obfuscate(account), in_progess_instances(hass)) + _LOGGER.debug("Logging in: %s %s", obfuscate(account), in_progress_instances(hass)) _LOGGER.debug("Login stats: %s", login.stats) message: str = ( f"Reauthenticate {login.email} on the [Integrations](/config/integrations) page. " @@ -1470,7 +1470,7 @@ async def test_login_status(hass, config_entry, login) -> bool: f"{account[CONF_EMAIL]} - {account[CONF_URL]}" ) if flow: - if flow.get("flow_id") in in_progess_instances(hass): + if flow.get("flow_id") in in_progress_instances(hass): _LOGGER.debug("Existing config flow detected") return False _LOGGER.debug("Stopping orphaned config flow %s", flow.get("flow_id"))