Skip to content

Commit

Permalink
Use reauth helpers in honeywell (home-assistant#128629)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Oct 18, 2024
1 parent 409f1bb commit a7b5e43
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions homeassistant/components/honeywell/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,20 @@ 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(
self, user_input: dict[str, Any] | None = None
) -> 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(
Expand All @@ -72,18 +69,14 @@ async def async_step_reauth_confirm(
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"},
Expand Down

0 comments on commit a7b5e43

Please sign in to comment.