Use reauth helpers in honeywell (#128629)
parent
409f1bb644
commit
a7b5e4323e
|
@ -38,14 +38,11 @@ class HoneywellConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a honeywell config flow."""
|
"""Handle a honeywell config flow."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
entry: ConfigEntry | None
|
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(
|
||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle re-authentication with Honeywell."""
|
"""Handle re-authentication with Honeywell."""
|
||||||
|
|
||||||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
|
||||||
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(
|
||||||
|
@ -53,8 +50,8 @@ class HoneywellConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Confirm re-authentication with Honeywell."""
|
"""Confirm re-authentication with Honeywell."""
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
assert self.entry is not None
|
|
||||||
|
|
||||||
|
reauth_entry = self._get_reauth_entry()
|
||||||
if user_input:
|
if user_input:
|
||||||
try:
|
try:
|
||||||
await self.is_valid(
|
await self.is_valid(
|
||||||
|
@ -72,18 +69,14 @@ class HoneywellConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
else:
|
else:
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
self.entry,
|
reauth_entry,
|
||||||
data={
|
data_updates=user_input,
|
||||||
**self.entry.data,
|
|
||||||
**user_input,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="reauth_confirm",
|
step_id="reauth_confirm",
|
||||||
data_schema=self.add_suggested_values_to_schema(
|
data_schema=self.add_suggested_values_to_schema(
|
||||||
REAUTH_SCHEMA,
|
REAUTH_SCHEMA, reauth_entry.data
|
||||||
self.entry.data,
|
|
||||||
),
|
),
|
||||||
errors=errors,
|
errors=errors,
|
||||||
description_placeholders={"name": "Honeywell"},
|
description_placeholders={"name": "Honeywell"},
|
||||||
|
|
Loading…
Reference in New Issue