mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Do not cache the entry in lamarzocco config flow (#128010)
This commit is contained in:
parent
805bed092e
commit
11245dbb82
@ -54,9 +54,6 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
VERSION = 2
|
VERSION = 2
|
||||||
|
|
||||||
reauth_entry: ConfigEntry
|
|
||||||
reconfigure_entry: ConfigEntry
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize the config flow."""
|
"""Initialize the config flow."""
|
||||||
self._config: dict[str, Any] = {}
|
self._config: dict[str, Any] = {}
|
||||||
@ -73,7 +70,7 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
if user_input:
|
if user_input:
|
||||||
data: dict[str, Any] = {}
|
data: dict[str, Any] = {}
|
||||||
if self.source == SOURCE_REAUTH:
|
if self.source == SOURCE_REAUTH:
|
||||||
data = dict(self.reauth_entry.data)
|
data = dict(self._get_reauth_entry().data)
|
||||||
data = {
|
data = {
|
||||||
**data,
|
**data,
|
||||||
**user_input,
|
**user_input,
|
||||||
@ -99,7 +96,7 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
if not errors:
|
if not errors:
|
||||||
if self.source == SOURCE_REAUTH:
|
if self.source == SOURCE_REAUTH:
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
self.reauth_entry, data=data, reason="reauth_successful"
|
self._get_reauth_entry(), data=data
|
||||||
)
|
)
|
||||||
if self._discovered:
|
if self._discovered:
|
||||||
if self._discovered[CONF_MACHINE] not in self._fleet:
|
if self._discovered[CONF_MACHINE] not in self._fleet:
|
||||||
@ -208,12 +205,11 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
self.reconfigure_entry,
|
self._get_reconfigure_entry(),
|
||||||
data={
|
data={
|
||||||
**self._config,
|
**self._config,
|
||||||
CONF_MAC: user_input[CONF_MAC],
|
CONF_MAC: user_input[CONF_MAC],
|
||||||
},
|
},
|
||||||
reason="reconfigure_successful",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
bt_options = [
|
bt_options = [
|
||||||
@ -266,7 +262,6 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Perform reauth upon an API authentication error."""
|
"""Perform reauth upon an API authentication error."""
|
||||||
self.reauth_entry = self._get_reauth_entry()
|
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
||||||
async def async_step_reauth_confirm(
|
async def async_step_reauth_confirm(
|
||||||
@ -289,7 +284,6 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Perform reconfiguration of the config entry."""
|
"""Perform reconfiguration of the config entry."""
|
||||||
self.reconfigure_entry = self._get_reconfigure_entry()
|
|
||||||
return await self.async_step_reconfigure_confirm()
|
return await self.async_step_reconfigure_confirm()
|
||||||
|
|
||||||
async def async_step_reconfigure_confirm(
|
async def async_step_reconfigure_confirm(
|
||||||
@ -297,17 +291,18 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Confirm reconfiguration of the device."""
|
"""Confirm reconfiguration of the device."""
|
||||||
if not user_input:
|
if not user_input:
|
||||||
|
reconfigure_entry = self._get_reconfigure_entry()
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="reconfigure_confirm",
|
step_id="reconfigure_confirm",
|
||||||
data_schema=vol.Schema(
|
data_schema=vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(
|
vol.Required(
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
default=self.reconfigure_entry.data[CONF_USERNAME],
|
default=reconfigure_entry.data[CONF_USERNAME],
|
||||||
): str,
|
): str,
|
||||||
vol.Required(
|
vol.Required(
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
default=self.reconfigure_entry.data[CONF_PASSWORD],
|
default=reconfigure_entry.data[CONF_PASSWORD],
|
||||||
): str,
|
): str,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user