1 """Config flow for Yale integration."""
3 from collections.abc
import Mapping
12 from .const
import DOMAIN
14 _LOGGER = logging.getLogger(__name__)
17 class YaleConfigFlow(config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN):
18 """Handle a config flow for Yale."""
29 self, entry_data: Mapping[str, Any]
30 ) -> ConfigFlowResult:
31 """Handle configuration by re-auth."""
32 return await self.async_step_user()
35 """Get user ID from access token."""
40 options={
"verify_signature":
False},
43 return decoded[
"userId"]
46 """Create an entry for the flow."""
48 data[
"token"][
"access_token"]
50 await self.async_set_unique_id(user_id)
51 if self.
sourcesource == SOURCE_REAUTH:
52 self._abort_if_unique_id_mismatch(reason=
"reauth_invalid_user")
53 return self.async_update_reload_and_abort(
54 self._get_reauth_entry(), data=data
56 self._abort_if_unique_id_configured()
ConfigFlowResult async_step_reauth(self, Mapping[str, Any] entry_data)
str _async_get_user_id_from_access_token(self, str encoded)
ConfigFlowResult async_oauth_create_entry(self, dict data)
logging.Logger logger(self)