Use reauth helpers in honeywell (#128629)

pull/128634/head
epenet 2024-10-18 08:46:49 +02:00 committed by GitHub
parent 409f1bb644
commit a7b5e4323e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 11 deletions

View File

@ -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"},