Home Assistant Unofficial Reference 2024.12.1
config_flow.py
Go to the documentation of this file.
1 """Config flow for Ondilo ICO."""
2 
3 import logging
4 from typing import Any
5 
6 from homeassistant.config_entries import ConfigFlowResult
7 from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2FlowHandler
8 
9 from .const import DOMAIN
10 from .oauth_impl import OndiloOauth2Implementation
11 
12 
14  """Config flow to handle Ondilo ICO OAuth2 authentication."""
15 
16  DOMAIN = DOMAIN
17 
18  async def async_step_user(
19  self, user_input: dict[str, Any] | None = None
20  ) -> ConfigFlowResult:
21  """Handle a flow initialized by the user."""
22  await self.async_set_unique_idasync_set_unique_id(DOMAIN)
23 
24  self.async_register_implementationasync_register_implementation(
25  self.hass,
26  OndiloOauth2Implementation(self.hass),
27  )
28 
29  return await super().async_step_user(user_input)
30 
31  @property
32  def logger(self) -> logging.Logger:
33  """Return logger."""
34  return logging.getLogger(__name__)
35 
36  @property
37  def extra_authorize_data(self) -> dict:
38  """Extra data that needs to be appended to the authorize url."""
39  return {"scope": "api"}
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
Definition: config_flow.py:20
ConfigEntry|None async_set_unique_id(self, str|None unique_id=None, *bool raise_on_progress=True)
None async_register_implementation(cls, HomeAssistant hass, LocalOAuth2Implementation local_impl)