From 703e51d50054561212ef364ea27bcbea6ffae135 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sat, 19 Oct 2024 14:43:14 +0200 Subject: [PATCH] Use new reauth helpers in sensibo (#128738) --- homeassistant/components/sensibo/config_flow.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/sensibo/config_flow.py b/homeassistant/components/sensibo/config_flow.py index 667f96fe1c2..926e8216196 100644 --- a/homeassistant/components/sensibo/config_flow.py +++ b/homeassistant/components/sensibo/config_flow.py @@ -8,7 +8,7 @@ from typing import Any from pysensibo.exceptions import AuthenticationError import voluptuous as vol -from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult +from homeassistant.config_entries import ConfigFlow, ConfigFlowResult from homeassistant.const import CONF_API_KEY from homeassistant.helpers.selector import TextSelector @@ -27,14 +27,10 @@ class SensiboConfigFlow(ConfigFlow, domain=DOMAIN): VERSION = 2 - entry: ConfigEntry | None - async def async_step_reauth( self, entry_data: Mapping[str, Any] ) -> ConfigFlowResult: """Handle re-authentication with Sensibo.""" - - self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"]) return await self.async_step_reauth_confirm() async def async_step_reauth_confirm( @@ -56,13 +52,11 @@ class SensiboConfigFlow(ConfigFlow, domain=DOMAIN): except NoUsernameError: errors["base"] = "no_username" else: - assert self.entry is not None - - if username == self.entry.unique_id: + reauth_entry = self._get_reauth_entry() + if username == reauth_entry.unique_id: return self.async_update_reload_and_abort( - self.entry, - data={ - **self.entry.data, + reauth_entry, + data_updates={ CONF_API_KEY: api_key, }, )