1 """Config flow for the LiteJet lighting system."""
3 from __future__
import annotations
8 from serial
import SerialException
9 import voluptuous
as vol
21 from .const
import CONF_DEFAULT_TRANSITION, DOMAIN
25 """Handle LiteJet options."""
28 self, user_input: dict[str, Any] |
None =
None
29 ) -> ConfigFlowResult:
30 """Manage LiteJet options."""
31 if user_input
is not None:
36 data_schema=vol.Schema(
39 CONF_DEFAULT_TRANSITION,
41 CONF_DEFAULT_TRANSITION, 0
50 """LiteJet config flow."""
53 self, user_input: dict[str, Any] |
None =
None
54 ) -> ConfigFlowResult:
55 """Create a LiteJet config entry based upon user input."""
57 if user_input
is not None:
58 port = user_input[CONF_PORT]
61 system = await pylitejet.open(port)
62 except SerialException:
63 errors[CONF_PORT] =
"open_failed"
68 data={CONF_PORT: port},
73 data_schema=vol.Schema({vol.Required(CONF_PORT): str}),
80 config_entry: ConfigEntry,
81 ) -> LiteJetOptionsFlow:
82 """Get the options flow for this handler."""
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_step_init(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)
OptionsFlow async_get_options_flow(ConfigEntry config_entry)
ConfigEntry config_entry(self)
None config_entry(self, ConfigEntry value)
_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)