1 """Config flow for Autarco integration."""
3 from __future__
import annotations
7 from autarco
import Autarco, AutarcoAuthenticationError, AutarcoConnectionError
8 import voluptuous
as vol
14 from .const
import DOMAIN
16 DATA_SCHEMA = vol.Schema(
18 vol.Required(CONF_EMAIL): str,
19 vol.Required(CONF_PASSWORD): str,
25 """Handle a config flow for Autarco."""
28 self, user_input: dict[str, Any] |
None =
None
29 ) -> ConfigFlowResult:
30 """Handle the initial step."""
31 errors: dict[str, str] = {}
32 if user_input
is not None:
35 email=user_input[CONF_EMAIL],
36 password=user_input[CONF_PASSWORD],
40 await client.get_account()
41 except AutarcoAuthenticationError:
42 errors[
"base"] =
"invalid_auth"
43 except AutarcoConnectionError:
44 errors[
"base"] =
"cannot_connect"
47 title=user_input[CONF_EMAIL],
49 CONF_EMAIL: user_input[CONF_EMAIL],
50 CONF_PASSWORD: user_input[CONF_PASSWORD],
56 data_schema=DATA_SCHEMA,
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)
None _async_abort_entries_match(self, dict[str, Any]|None match_dict=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)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)