diff --git a/homeassistant/components/webostv/config_flow.py b/homeassistant/components/webostv/config_flow.py index f380e49f8a3..4bc2c5ca258 100644 --- a/homeassistant/components/webostv/config_flow.py +++ b/homeassistant/components/webostv/config_flow.py @@ -4,7 +4,7 @@ from __future__ import annotations from collections.abc import Mapping import logging -from typing import Any +from typing import Any, Self from urllib.parse import urlparse from aiowebostv import WebOsTvPairError @@ -92,7 +92,6 @@ class FlowHandler(ConfigFlow, domain=DOMAIN): """Display pairing form.""" self._async_check_configured_entry() - self.context[CONF_HOST] = self._host self.context["title_placeholders"] = {"name": self._name} errors = {} @@ -130,13 +129,16 @@ class FlowHandler(ConfigFlow, domain=DOMAIN): await self.async_set_unique_id(uuid) self._abort_if_unique_id_configured({CONF_HOST: self._host}) - for progress in self._async_in_progress(): - if progress.get("context", {}).get(CONF_HOST) == self._host: - return self.async_abort(reason="already_in_progress") + if self.hass.config_entries.flow.async_has_matching_flow(self): + return self.async_abort(reason="already_in_progress") self._uuid = uuid return await self.async_step_pairing() + def is_matching(self, other_flow: Self) -> bool: + """Return True if other_flow is matching this flow.""" + return other_flow._host == self._host # noqa: SLF001 + async def async_step_reauth( self, entry_data: Mapping[str, Any] ) -> ConfigFlowResult: