From 4d49cb2d1867f83af79d2029bd6e6e60b7c90a26 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:49:38 +0200 Subject: [PATCH] Use _get_reconfigure_entry in waze_travel_time (#127314) --- .../components/waze_travel_time/config_flow.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/waze_travel_time/config_flow.py b/homeassistant/components/waze_travel_time/config_flow.py index cdc2071cb37..6c484d43dcb 100644 --- a/homeassistant/components/waze_travel_time/config_flow.py +++ b/homeassistant/components/waze_travel_time/config_flow.py @@ -8,6 +8,7 @@ from typing import Any import voluptuous as vol from homeassistant.config_entries import ( + SOURCE_RECONFIGURE, ConfigEntry, ConfigFlow, ConfigFlowResult, @@ -142,9 +143,7 @@ class WazeConfigFlow(ConfigFlow, domain=DOMAIN): VERSION = 2 - def __init__(self) -> None: - """Init Config Flow.""" - self._entry: ConfigEntry | None = None + _entry: ConfigEntry @staticmethod @callback @@ -169,7 +168,7 @@ class WazeConfigFlow(ConfigFlow, domain=DOMAIN): user_input[CONF_DESTINATION], user_input[CONF_REGION], ): - if self._entry: + if self.source == SOURCE_RECONFIGURE: return self.async_update_reload_and_abort( self._entry, title=user_input[CONF_NAME], @@ -196,8 +195,7 @@ class WazeConfigFlow(ConfigFlow, domain=DOMAIN): self, entry_data: Mapping[str, Any] ) -> ConfigFlowResult: """Handle reconfiguration.""" - self._entry = self.hass.config_entries.async_get_entry(self.context["entry_id"]) - assert self._entry + self._entry = self._get_reconfigure_entry() data = self._entry.data.copy() data[CONF_REGION] = data[CONF_REGION].lower()