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