mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use _get_reconfigure_entry in waze_travel_time (#127314)
This commit is contained in:
parent
5759539e08
commit
4d49cb2d18
@ -8,6 +8,7 @@ from typing import Any
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import (
|
from homeassistant.config_entries import (
|
||||||
|
SOURCE_RECONFIGURE,
|
||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
@ -142,9 +143,7 @@ class WazeConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
VERSION = 2
|
VERSION = 2
|
||||||
|
|
||||||
def __init__(self) -> None:
|
_entry: ConfigEntry
|
||||||
"""Init Config Flow."""
|
|
||||||
self._entry: ConfigEntry | None = None
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
@ -169,7 +168,7 @@ class WazeConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
user_input[CONF_DESTINATION],
|
user_input[CONF_DESTINATION],
|
||||||
user_input[CONF_REGION],
|
user_input[CONF_REGION],
|
||||||
):
|
):
|
||||||
if self._entry:
|
if self.source == SOURCE_RECONFIGURE:
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
self._entry,
|
self._entry,
|
||||||
title=user_input[CONF_NAME],
|
title=user_input[CONF_NAME],
|
||||||
@ -196,8 +195,7 @@ class WazeConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle reconfiguration."""
|
"""Handle reconfiguration."""
|
||||||
self._entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
self._entry = self._get_reconfigure_entry()
|
||||||
assert self._entry
|
|
||||||
|
|
||||||
data = self._entry.data.copy()
|
data = self._entry.data.copy()
|
||||||
data[CONF_REGION] = data[CONF_REGION].lower()
|
data[CONF_REGION] = data[CONF_REGION].lower()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user