diff --git a/homeassistant/components/steamist/config_flow.py b/homeassistant/components/steamist/config_flow.py index b5cb6527fa3..f22eafc6afd 100644 --- a/homeassistant/components/steamist/config_flow.py +++ b/homeassistant/components/steamist/config_flow.py @@ -3,7 +3,7 @@ from __future__ import annotations import logging -from typing import Any +from typing import Any, Self from aiosteamist import Steamist from discovery30303 import Device30303, normalize_mac @@ -33,6 +33,8 @@ class SteamistConfigFlow(ConfigFlow, domain=DOMAIN): VERSION = 1 + host: str | None = None + def __init__(self) -> None: """Initialize the config flow.""" self._discovered_devices: dict[str, Device30303] = {} @@ -78,10 +80,9 @@ class SteamistConfigFlow(ConfigFlow, domain=DOMAIN): ): self.hass.config_entries.async_schedule_reload(entry.entry_id) return self.async_abort(reason="already_configured") - self.context[CONF_HOST] = host - for progress in self._async_in_progress(): - if progress.get("context", {}).get(CONF_HOST) == host: - return self.async_abort(reason="already_in_progress") + self.host = host + if self.hass.config_entries.flow.async_has_matching_flow(self): + return self.async_abort(reason="already_in_progress") if not device.name: discovery = await async_discover_device(self.hass, device.ipaddress) if not discovery: @@ -92,6 +93,10 @@ class SteamistConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="not_steamist_device") return await self.async_step_discovery_confirm() + def is_matching(self, other_flow: Self) -> bool: + """Return True if other_flow is matching this flow.""" + return other_flow.host == self.host + async def async_step_discovery_confirm( self, user_input: dict[str, Any] | None = None ) -> ConfigFlowResult: