1 """Config flow for Weheat."""
3 from collections.abc
import Mapping
7 from weheat.abstractions.user
import get_user_id_from_token
13 from .const
import API_URL, DOMAIN, ENTRY_TITLE, OAUTH2_SCOPES
17 """Config flow to handle Weheat OAuth2 authentication."""
24 return logging.getLogger(__name__)
28 """Extra data that needs to be appended to the authorize url."""
30 "scope":
" ".join(OAUTH2_SCOPES),
34 """Override the create entry method to change to the step to find the heat pumps."""
36 user_id = await get_user_id_from_token(
37 API_URL, data[CONF_TOKEN][CONF_ACCESS_TOKEN]
51 self, entry_data: Mapping[str, Any]
52 ) -> ConfigFlowResult:
53 """Perform reauth upon an API authentication error."""
57 self, user_input: dict[str, Any] |
None =
None
58 ) -> ConfigFlowResult:
59 """Confirm reauth dialog."""
60 if user_input
is None:
dict[str, str] extra_authorize_data(self)
logging.Logger logger(self)
ConfigFlowResult async_step_reauth_confirm(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_oauth_create_entry(self, dict data)
ConfigFlowResult async_step_reauth(self, Mapping[str, Any] entry_data)
None _abort_if_unique_id_configured(self, dict[str, Any]|None updates=None, bool reload_on_update=True, *str error="already_configured")
ConfigEntry _get_reauth_entry(self)
ConfigEntry|None async_set_unique_id(self, str|None unique_id=None, *bool raise_on_progress=True)
ConfigFlowResult async_create_entry(self, *str title, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None, Mapping[str, Any]|None options=None)
ConfigFlowResult async_update_reload_and_abort(self, ConfigEntry entry, *str|None|UndefinedType unique_id=UNDEFINED, str|UndefinedType title=UNDEFINED, Mapping[str, Any]|UndefinedType data=UNDEFINED, Mapping[str, Any]|UndefinedType data_updates=UNDEFINED, Mapping[str, Any]|UndefinedType options=UNDEFINED, str|UndefinedType reason=UNDEFINED, bool reload_even_if_entry_is_unchanged=True)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
None _abort_if_unique_id_mismatch(self, *str reason="unique_id_mismatch", Mapping[str, str]|None description_placeholders=None)
ConfigFlowResult async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
_FlowResultT async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
_FlowResultT async_create_entry(self, *str|None title=None, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None)
config_entries.ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)