1 """Config flow for Renson integration."""
3 from __future__
import annotations
8 from renson_endura_delta
import renson
9 import voluptuous
as vol
16 from .const
import DOMAIN
18 _LOGGER = logging.getLogger(__name__)
20 STEP_USER_DATA_SCHEMA = vol.Schema(
22 vol.Required(CONF_HOST): str,
28 """Handle a config flow for Renson."""
33 self, hass: HomeAssistant, data: dict[str, Any]
35 """Validate the user input allows us to connect."""
36 api = renson.RensonVentilation(data[CONF_HOST])
38 if not await self.hass.async_add_executor_job(api.connect):
41 return {
"title":
"Renson"}
44 self, user_input: dict[str, Any] |
None =
None
45 ) -> ConfigFlowResult:
46 """Handle the initial step."""
47 if user_input
is None:
49 step_id=
"user", data_schema=STEP_USER_DATA_SCHEMA
55 info = await self.
validate_inputvalidate_input(self.hass, user_input)
57 errors[
"base"] =
"cannot_connect"
59 _LOGGER.exception(
"Unexpected exception")
60 errors[
"base"] =
"unknown"
65 step_id=
"user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
70 """Error to indicate we cannot connect."""
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
dict[str, Any] validate_input(self, HomeAssistant hass, dict[str, Any] data)
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)