1 """Config flow for Min/Max integration."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
6 from typing
import Any, cast
8 import voluptuous
as vol
16 SchemaConfigFlowHandler,
20 from .const
import CONF_ENTITY_IDS, CONF_ROUND_DIGITS, DOMAIN
22 _STATISTIC_MEASURES = [
33 OPTIONS_SCHEMA = vol.Schema(
35 vol.Required(CONF_ENTITY_IDS): selector.EntitySelector(
36 selector.EntitySelectorConfig(
37 domain=[SENSOR_DOMAIN, NUMBER_DOMAIN, INPUT_NUMBER_DOMAIN],
41 vol.Required(CONF_TYPE): selector.SelectSelector(
42 selector.SelectSelectorConfig(
43 options=_STATISTIC_MEASURES, translation_key=CONF_TYPE
46 vol.Required(CONF_ROUND_DIGITS, default=2): selector.NumberSelector(
47 selector.NumberSelectorConfig(
48 min=0, max=6, mode=selector.NumberSelectorMode.BOX
54 CONFIG_SCHEMA = vol.Schema(
56 vol.Required(
"name"): selector.TextSelector(),
58 ).extend(OPTIONS_SCHEMA.schema)
70 """Handle a config or options flow for Min/Max."""
72 config_flow = CONFIG_FLOW
73 options_flow = OPTIONS_FLOW
76 """Return config entry title."""
77 return cast(str, options[
"name"])
if "name" in options
else ""
str async_config_entry_title(self, Mapping[str, Any] options)