1 """Config flow for Version integration."""
3 from __future__
import annotations
7 import voluptuous
as vol
21 DEFAULT_CONFIGURATION,
29 VALID_CONTAINER_IMAGES,
37 """Handle a config flow for Version."""
42 """Initialize the Version config flow."""
43 self.
_entry_data_entry_data: dict[str, Any] = DEFAULT_CONFIGURATION.copy()
47 user_input: dict[str, Any] |
None =
None,
48 ) -> ConfigFlowResult:
49 """Handle the initial user step."""
50 if user_input
is None:
54 data_schema=vol.Schema(
58 default=VERSION_SOURCE_LOCAL,
59 ): vol.In(VERSION_SOURCE_MAP.keys())
64 user_input[CONF_SOURCE] = VERSION_SOURCE_MAP[user_input[CONF_VERSION_SOURCE]]
80 user_input: dict[str, Any] |
None =
None,
81 ) -> ConfigFlowResult:
82 """Handle the version_source step."""
83 if user_input
is None:
88 data_schema = vol.Schema(
91 CONF_CHANNEL, default=DEFAULT_CHANNEL.title()
92 ): vol.In(VALID_CHANNELS),
95 if self.
_entry_data_entry_data[CONF_SOURCE] ==
"supervisor":
96 data_schema = data_schema.extend(
98 vol.Required(CONF_IMAGE, default=DEFAULT_IMAGE): vol.In(
101 vol.Required(CONF_BOARD, default=DEFAULT_BOARD): vol.In(
107 data_schema = data_schema.extend(
109 vol.Required(CONF_IMAGE, default=DEFAULT_IMAGE): vol.In(
110 VALID_CONTAINER_IMAGES
115 data_schema = vol.Schema({vol.Required(CONF_BETA, default=
False): bool})
118 step_id=STEP_VERSION_SOURCE,
119 data_schema=data_schema,
120 description_placeholders={
121 ATTR_VERSION_SOURCE: self.
_entry_data_entry_data[CONF_VERSION_SOURCE]
133 """Return the name of the config entry."""
134 if self.
_entry_data_entry_data[CONF_SOURCE] ==
"local":
135 return DEFAULT_NAME_CURRENT
137 name = self.
_entry_data_entry_data[CONF_VERSION_SOURCE]
139 if (channel := self.
_entry_data_entry_data[CONF_CHANNEL]) != DEFAULT_CHANNEL:
140 return f
"{name} {channel.title()}"
ConfigFlowResult async_step_version_source(self, dict[str, Any]|None user_input=None)
str _config_entry_name(self)
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)
bool show_advanced_options(self)
_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)
IssData update(pyiss.ISS iss)