From 30a244de7a466701121b7dc0b2b6289308ad002c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:56:07 +0200 Subject: [PATCH] Do not cache reconfigure entry in tado config flow (#128024) --- homeassistant/components/tado/config_flow.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/tado/config_flow.py b/homeassistant/components/tado/config_flow.py index 9fd2030844f..c8839b3a919 100644 --- a/homeassistant/components/tado/config_flow.py +++ b/homeassistant/components/tado/config_flow.py @@ -73,7 +73,6 @@ class TadoConfigFlow(ConfigFlow, domain=DOMAIN): """Handle a config flow for Tado.""" VERSION = 1 - config_entry: ConfigEntry async def async_step_user( self, user_input: dict[str, Any] | None = None @@ -120,7 +119,6 @@ class TadoConfigFlow(ConfigFlow, domain=DOMAIN): self, user_input: dict[str, Any] | None = None ) -> ConfigFlowResult: """Handle a reconfiguration flow initialized by the user.""" - self.config_entry = self._get_reconfigure_entry() return await self.async_step_reconfigure_confirm() async def async_step_reconfigure_confirm( @@ -128,9 +126,10 @@ class TadoConfigFlow(ConfigFlow, domain=DOMAIN): ) -> ConfigFlowResult: """Handle a reconfiguration flow initialized by the user.""" errors: dict[str, str] = {} + reconfigure_entry = self._get_reconfigure_entry() if user_input is not None: - user_input[CONF_USERNAME] = self.config_entry.data[CONF_USERNAME] + user_input[CONF_USERNAME] = reconfigure_entry.data[CONF_USERNAME] try: await validate_input(self.hass, user_input) except CannotConnect: @@ -145,9 +144,7 @@ class TadoConfigFlow(ConfigFlow, domain=DOMAIN): if not errors: return self.async_update_reload_and_abort( - self.config_entry, - data={**self.config_entry.data, **user_input}, - reason="reconfigure_successful", + reconfigure_entry, data_updates=user_input ) return self.async_show_form( @@ -159,7 +156,7 @@ class TadoConfigFlow(ConfigFlow, domain=DOMAIN): ), errors=errors, description_placeholders={ - CONF_USERNAME: self.config_entry.data[CONF_USERNAME] + CONF_USERNAME: reconfigure_entry.data[CONF_USERNAME] }, )