1 """Config flow to configure zone component."""
3 from __future__
import annotations
8 from iaqualink.client
import AqualinkClient
9 from iaqualink.exception
import (
10 AqualinkServiceException,
11 AqualinkServiceUnauthorizedException,
13 import voluptuous
as vol
18 from .const
import DOMAIN
22 """Aqualink config flow."""
27 self, user_input: dict[str, Any] |
None =
None
28 ) -> ConfigFlowResult:
29 """Handle a flow start."""
32 if user_input
is not None:
33 username = user_input[CONF_USERNAME]
34 password = user_input[CONF_PASSWORD]
37 async
with AqualinkClient(username, password):
39 except AqualinkServiceUnauthorizedException:
40 errors[
"base"] =
"invalid_auth"
41 except (AqualinkServiceException, httpx.HTTPError):
42 errors[
"base"] =
"cannot_connect"
48 data_schema=vol.Schema(
50 vol.Required(CONF_USERNAME): str,
51 vol.Required(CONF_PASSWORD): str,
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
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_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)