From 56e79de7071ae27507c4d302a31a26aa1f6f1ad3 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:35:34 +0200 Subject: [PATCH] Use _get_reauth_entry in trafikverket_weatherstation (#127316) --- .../components/trafikverket_weatherstation/config_flow.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/trafikverket_weatherstation/config_flow.py b/homeassistant/components/trafikverket_weatherstation/config_flow.py index cf7ca905acb..e5716818c61 100644 --- a/homeassistant/components/trafikverket_weatherstation/config_flow.py +++ b/homeassistant/components/trafikverket_weatherstation/config_flow.py @@ -26,7 +26,7 @@ class TVWeatherConfigFlow(ConfigFlow, domain=DOMAIN): VERSION = 1 - entry: ConfigEntry | None = None + entry: ConfigEntry async def validate_input(self, sensor_api: str, station: str) -> None: """Validate input from user input.""" @@ -80,7 +80,7 @@ class TVWeatherConfigFlow(ConfigFlow, domain=DOMAIN): ) -> ConfigFlowResult: """Handle re-authentication with Trafikverket.""" - self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"]) + self.entry = self._get_reauth_entry() return await self.async_step_reauth_confirm() async def async_step_reauth_confirm( @@ -92,8 +92,6 @@ class TVWeatherConfigFlow(ConfigFlow, domain=DOMAIN): if user_input: api_key = user_input[CONF_API_KEY] - assert self.entry is not None - try: await self.validate_input(api_key, self.entry.data[CONF_STATION]) except InvalidAuthentication: