Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix typo in in_progress_instances #2541

Merged
merged 5 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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. "
Expand All @@ -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"))
Expand Down
10 changes: 7 additions & 3 deletions custom_components/alexa_media/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ def configured_instances(hass):


@callback
def in_progess_instances(hass):
"""Return a set of in progress Alexa Media flows."""
return {entry["flow_id"] for entry in hass.config_entries.flow.async_progress()}
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
}


@config_entries.HANDLERS.register(DOMAIN)
Expand Down
Loading