1 """The history_stats component config flow."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
6 from typing
import Any, cast
8 import voluptuous
as vol
12 SchemaCommonFlowHandler,
13 SchemaConfigFlowHandler,
19 DurationSelectorConfig,
42 handler: SchemaCommonFlowHandler, user_input: dict[str, Any]
44 """Validate options selected."""
45 if sum(param
in user_input
for param
in CONF_PERIOD_KEYS) != 2:
48 handler.parent_handler._async_abort_entries_match({**handler.options, **user_input})
53 DATA_SCHEMA_SETUP = vol.Schema(
55 vol.Required(CONF_NAME, default=DEFAULT_NAME):
TextSelector(),
60 options=CONF_TYPE_KEYS,
61 mode=SelectSelectorMode.DROPDOWN,
62 translation_key=CONF_TYPE,
67 DATA_SCHEMA_OPTIONS = vol.Schema(
79 schema=DATA_SCHEMA_SETUP,
83 schema=DATA_SCHEMA_OPTIONS,
84 validate_user_input=validate_options,
90 validate_user_input=validate_options,
96 """Handle a config flow for History stats."""
98 config_flow = CONFIG_FLOW
99 options_flow = OPTIONS_FLOW
102 """Return config entry title."""
103 return cast(str, options[CONF_NAME])
str async_config_entry_title(self, Mapping[str, Any] options)
dict[str, Any] validate_options(SchemaCommonFlowHandler handler, dict[str, Any] user_input)