1 """Config flow for Generic hygrostat."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
6 from typing
import Any, cast
8 import voluptuous
as vol
16 SchemaConfigFlowHandler,
32 vol.Required(CONF_DEVICE_CLASS): selector.SelectSelector(
33 selector.SelectSelectorConfig(
35 HumidifierDeviceClass.HUMIDIFIER,
36 HumidifierDeviceClass.DEHUMIDIFIER,
38 translation_key=CONF_DEVICE_CLASS,
39 mode=selector.SelectSelectorMode.DROPDOWN,
42 vol.Required(CONF_SENSOR): selector.EntitySelector(
43 selector.EntitySelectorConfig(
44 domain=SENSOR_DOMAIN, device_class=SensorDeviceClass.HUMIDITY
47 vol.Required(CONF_HUMIDIFIER): selector.EntitySelector(
48 selector.EntitySelectorConfig(domain=[switch.DOMAIN, fan.DOMAIN])
51 CONF_DRY_TOLERANCE, default=DEFAULT_TOLERANCE
52 ): selector.NumberSelector(
53 selector.NumberSelectorConfig(
57 unit_of_measurement=PERCENTAGE,
58 mode=selector.NumberSelectorMode.BOX,
62 CONF_WET_TOLERANCE, default=DEFAULT_TOLERANCE
63 ): selector.NumberSelector(
64 selector.NumberSelectorConfig(
68 unit_of_measurement=PERCENTAGE,
69 mode=selector.NumberSelectorMode.BOX,
72 vol.Optional(CONF_MIN_DUR): selector.DurationSelector(
73 selector.DurationSelectorConfig(allow_negative=
False)
78 vol.Required(CONF_NAME): selector.TextSelector(),
93 """Handle a config or options flow."""
95 config_flow = CONFIG_FLOW
96 options_flow = OPTIONS_FLOW
99 """Return config entry title."""
100 return cast(str, options[
"name"])
str async_config_entry_title(self, Mapping[str, Any] options)