1 """Config flow for Smarty integration."""
5 from pysmarty2
import Smarty
6 import voluptuous
as vol
11 from .const
import DOMAIN
15 """Smarty config flow."""
18 """Test the connection to the Smarty API."""
19 smarty = Smarty(host=host)
26 return "cannot_connect"
29 self, user_input: dict[str, Any] |
None =
None
30 ) -> ConfigFlowResult:
31 """Handle a flow initialized by the user."""
32 errors: dict[str, str] = {}
34 if user_input
is not None:
36 error = await self.hass.async_add_executor_job(
41 title=user_input[CONF_HOST], data=user_input
43 errors[
"base"] = error
46 data_schema=vol.Schema({vol.Required(CONF_HOST): str}),
51 self, import_config: dict[str, Any]
52 ) -> ConfigFlowResult:
53 """Handle a flow initialized by import."""
54 error = await self.hass.async_add_executor_job(
59 title=import_config[CONF_NAME],
60 data={CONF_HOST: import_config[CONF_HOST]},
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_step_import(self, dict[str, Any] import_config)
str|None _test_connection(self, str host)
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_abort(self, *str reason, Mapping[str, str]|None description_placeholders=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)
_FlowResultT async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)