Add Ondilo ico integration (#44728)
* First implementationof Ondilo component support * Update manifest toadd pypi pkg dependency * Update entities name and corrected refresh issue * Changed percentage unit name * Corrected merge issues * Updated coveragerc * cleaned up code and corrected config flow tests * Code cleanup and added test for exisitng entry * Changes following PR comments: - Inherit CoordinatorEntity instead of Entity - Merged pools blocking calls into one - Renamed devices vars to sensors - Check supported sensor types - Stop relying on array index position for pools - Stop relying on attribute position in dict for sensors * Corrected unit test * Reformat sensor type check
This commit is contained in:
parent
c92353088c
commit
de780c6d35
16 changed files with 514 additions and 0 deletions
43
homeassistant/components/ondilo_ico/config_flow.py
Normal file
43
homeassistant/components/ondilo_ico/config_flow.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
"""Config flow for Ondilo ICO."""
|
||||
import logging
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
|
||||
from .const import DOMAIN
|
||||
from .oauth_impl import OndiloOauth2Implementation
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OAuth2FlowHandler(
|
||||
config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN
|
||||
):
|
||||
"""Config flow to handle Ondilo ICO OAuth2 authentication."""
|
||||
|
||||
DOMAIN = DOMAIN
|
||||
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Handle a flow initialized by the user."""
|
||||
await self.async_set_unique_id(DOMAIN)
|
||||
|
||||
if self._async_current_entries():
|
||||
return self.async_abort(reason="single_instance_allowed")
|
||||
|
||||
self.async_register_implementation(
|
||||
self.hass,
|
||||
OndiloOauth2Implementation(self.hass),
|
||||
)
|
||||
|
||||
return await super().async_step_user(user_input)
|
||||
|
||||
@property
|
||||
def logger(self) -> logging.Logger:
|
||||
"""Return logger."""
|
||||
return logging.getLogger(__name__)
|
||||
|
||||
@property
|
||||
def extra_authorize_data(self) -> dict:
|
||||
"""Extra data that needs to be appended to the authorize url."""
|
||||
return {"scope": "api"}
|
Loading…
Add table
Add a link
Reference in a new issue