diff --git a/homeassistant/components/vodafone_station/config_flow.py b/homeassistant/components/vodafone_station/config_flow.py index 6b6adb6a18dc64c45a8580e242eb627dabe2e7a0..c373520bc58a28437a2def7fcc25cc86a175ca7c 100644 --- a/homeassistant/components/vodafone_station/config_flow.py +++ b/homeassistant/components/vodafone_station/config_flow.py @@ -60,7 +60,6 @@ class VodafoneStationConfigFlow(ConfigFlow, domain=DOMAIN): """Handle a config flow for Vodafone Station.""" VERSION = 1 - entry: ConfigEntry | None = None @staticmethod @callback @@ -106,21 +105,19 @@ class VodafoneStationConfigFlow(ConfigFlow, domain=DOMAIN): self, entry_data: Mapping[str, Any] ) -> ConfigFlowResult: """Handle reauth flow.""" - self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"]) - assert self.entry - self.context["title_placeholders"] = {"host": self.entry.data[CONF_HOST]} + self.context["title_placeholders"] = {"host": entry_data[CONF_HOST]} return await self.async_step_reauth_confirm() async def async_step_reauth_confirm( self, user_input: dict[str, Any] | None = None ) -> ConfigFlowResult: """Handle reauth confirm.""" - assert self.entry errors = {} + reauth_entry = self._get_reauth_entry() if user_input is not None: try: - await validate_input(self.hass, {**self.entry.data, **user_input}) + await validate_input(self.hass, {**reauth_entry.data, **user_input}) except aiovodafone_exceptions.AlreadyLogged: errors["base"] = "already_logged" except aiovodafone_exceptions.CannotConnect: @@ -131,21 +128,16 @@ class VodafoneStationConfigFlow(ConfigFlow, domain=DOMAIN): _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: - self.hass.config_entries.async_update_entry( - self.entry, - data={ - **self.entry.data, + return self.async_update_reload_and_abort( + reauth_entry, + data_updates={ CONF_PASSWORD: user_input[CONF_PASSWORD], }, ) - self.hass.async_create_task( - self.hass.config_entries.async_reload(self.entry.entry_id) - ) - return self.async_abort(reason="reauth_successful") return self.async_show_form( step_id="reauth_confirm", - description_placeholders={CONF_HOST: self.entry.data[CONF_HOST]}, + description_placeholders={CONF_HOST: reauth_entry.data[CONF_HOST]}, data_schema=STEP_REAUTH_DATA_SCHEMA, errors=errors, )