1 """Config flow for Honeywell Lyric."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
12 from .const
import DOMAIN
16 config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN
18 """Config flow to handle Honeywell Lyric OAuth2 authentication."""
25 return logging.getLogger(__name__)
28 self, entry_data: Mapping[str, Any]
29 ) -> ConfigFlowResult:
30 """Perform reauth upon an API authentication error."""
34 self, user_input: dict[str, Any] |
None =
None
35 ) -> ConfigFlowResult:
36 """Dialog that informs the user that reauth is required."""
37 if user_input
is None:
38 return self.async_show_form(step_id=
"reauth_confirm")
39 return await self.async_step_user()
42 """Create an oauth config entry or update existing entry for reauth."""
43 existing_entry = await self.async_set_unique_id(DOMAIN)
45 self.hass.config_entries.async_update_entry(existing_entry, data=data)
46 await self.hass.config_entries.async_reload(existing_entry.entry_id)
47 return self.async_abort(reason=
"reauth_successful")
48 return self.async_create_entry(title=
"Lyric", data=data)
ConfigFlowResult async_step_reauth(self, Mapping[str, Any] entry_data)
ConfigFlowResult async_step_reauth_confirm(self, dict[str, Any]|None user_input=None)
logging.Logger logger(self)
ConfigFlowResult async_oauth_create_entry(self, dict[str, Any] data)