From 73fad671ed6c58c76f56a1a6064ac03f01235615 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 1 Oct 2024 11:09:29 +0200 Subject: [PATCH] Store arcam_fmj flow data in flow handler attributes (#127166) --- .../components/arcam_fmj/config_flow.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/arcam_fmj/config_flow.py b/homeassistant/components/arcam_fmj/config_flow.py index 514445ea604..6c037591688 100644 --- a/homeassistant/components/arcam_fmj/config_flow.py +++ b/homeassistant/components/arcam_fmj/config_flow.py @@ -22,6 +22,9 @@ class ArcamFmjFlowHandler(ConfigFlow, domain=DOMAIN): VERSION = 1 + host: str + port: int + async def _async_set_unique_id_and_update( self, host: str, port: int, uuid: str ) -> None: @@ -74,16 +77,11 @@ class ArcamFmjFlowHandler(ConfigFlow, domain=DOMAIN): self, user_input: dict[str, Any] | None = None ) -> ConfigFlowResult: """Handle user-confirmation of discovered node.""" - context = self.context - placeholders = { - "host": context[CONF_HOST], - } - context["title_placeholders"] = placeholders + placeholders = {"host": self.host} + self.context["title_placeholders"] = placeholders if user_input is not None: - return await self._async_check_and_create( - context[CONF_HOST], context[CONF_PORT] - ) + return await self._async_check_and_create(self.host, self.port) return self.async_show_form( step_id="confirm", description_placeholders=placeholders @@ -101,7 +99,6 @@ class ArcamFmjFlowHandler(ConfigFlow, domain=DOMAIN): await self._async_set_unique_id_and_update(host, port, uuid) - context = self.context - context[CONF_HOST] = host - context[CONF_PORT] = DEFAULT_PORT + self.host = host + self.port = DEFAULT_PORT return await self.async_step_confirm()