36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
|
"""Config flow for Ondilo."""
|
||
|
import logging
|
||
|
|
||
|
from homeassistant import config_entries
|
||
|
from homeassistant.helpers import config_entry_oauth2_flow
|
||
|
|
||
|
from .const import DOMAIN
|
||
|
|
||
|
_LOGGER = logging.getLogger(__name__)
|
||
|
|
||
|
|
||
|
class OndiloFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN):
|
||
|
"""Config flow to handle Ondilo OAuth2 authentication."""
|
||
|
|
||
|
DOMAIN = DOMAIN
|
||
|
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
||
|
|
||
|
@property
|
||
|
def logger(self) -> logging.Logger:
|
||
|
"""Return logger."""
|
||
|
return logging.getLogger(__name__)
|
||
|
|
||
|
async def async_step_user(self, user_input=None):
|
||
|
"""Handle a flow start."""
|
||
|
print("async_step_user!!")
|
||
|
if self.hass.config_entries.async_entries(DOMAIN):
|
||
|
print("abort because already setup")
|
||
|
return self.async_abort(reason="already_setup")
|
||
|
print("works!")
|
||
|
return await super().async_step_user(user_input)
|
||
|
|
||
|
async def async_step_homekit(self, homekit_info):
|
||
|
"""Handle HomeKit discovery."""
|
||
|
print("async_step_homekit!!")
|
||
|
return await self.async_step_user()
|