Generic Thermostat Add Target Min Max to UI config (#131168)

Currently you can configure the minium and maximum target temperatures
if you create a generic thermostat in YAML. If you create it via the
UI, there is no option to configure them, you just get the climate
domain defaults.

This commit adds minimum and maximum fields to the first stage of the
generic thermostat config flow, so that UI users can also set min and
max.

Min and max are important as usually users want to select target
temperatures within a relatively narrow band, while the defaults create
a wide band. The wide band makes it hard to be accurate enough with the
arc style temperatue selector on the thermostat card.
This commit is contained in:
Hugh Saunders 2024-12-03 21:23:04 +00:00 committed by GitHub
parent a405d2b724
commit bb51837346
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 4 deletions

View File

@ -63,7 +63,9 @@ from .const import (
CONF_COLD_TOLERANCE, CONF_COLD_TOLERANCE,
CONF_HEATER, CONF_HEATER,
CONF_HOT_TOLERANCE, CONF_HOT_TOLERANCE,
CONF_MAX_TEMP,
CONF_MIN_DUR, CONF_MIN_DUR,
CONF_MIN_TEMP,
CONF_PRESETS, CONF_PRESETS,
CONF_SENSOR, CONF_SENSOR,
DEFAULT_TOLERANCE, DEFAULT_TOLERANCE,
@ -77,8 +79,6 @@ DEFAULT_NAME = "Generic Thermostat"
CONF_INITIAL_HVAC_MODE = "initial_hvac_mode" CONF_INITIAL_HVAC_MODE = "initial_hvac_mode"
CONF_KEEP_ALIVE = "keep_alive" CONF_KEEP_ALIVE = "keep_alive"
CONF_MIN_TEMP = "min_temp"
CONF_MAX_TEMP = "max_temp"
CONF_PRECISION = "precision" CONF_PRECISION = "precision"
CONF_TARGET_TEMP = "target_temp" CONF_TARGET_TEMP = "target_temp"
CONF_TEMP_STEP = "target_temp_step" CONF_TEMP_STEP = "target_temp_step"

View File

@ -21,7 +21,9 @@ from .const import (
CONF_COLD_TOLERANCE, CONF_COLD_TOLERANCE,
CONF_HEATER, CONF_HEATER,
CONF_HOT_TOLERANCE, CONF_HOT_TOLERANCE,
CONF_MAX_TEMP,
CONF_MIN_DUR, CONF_MIN_DUR,
CONF_MIN_TEMP,
CONF_PRESETS, CONF_PRESETS,
CONF_SENSOR, CONF_SENSOR,
DEFAULT_TOLERANCE, DEFAULT_TOLERANCE,
@ -57,6 +59,16 @@ OPTIONS_SCHEMA = {
vol.Optional(CONF_MIN_DUR): selector.DurationSelector( vol.Optional(CONF_MIN_DUR): selector.DurationSelector(
selector.DurationSelectorConfig(allow_negative=False) selector.DurationSelectorConfig(allow_negative=False)
), ),
vol.Optional(CONF_MIN_TEMP): selector.NumberSelector(
selector.NumberSelectorConfig(
mode=selector.NumberSelectorMode.BOX, unit_of_measurement=DEGREE, step=0.1
)
),
vol.Optional(CONF_MAX_TEMP): selector.NumberSelector(
selector.NumberSelectorConfig(
mode=selector.NumberSelectorMode.BOX, unit_of_measurement=DEGREE, step=0.1
)
),
} }
PRESETS_SCHEMA = { PRESETS_SCHEMA = {

View File

@ -18,7 +18,9 @@ CONF_AC_MODE = "ac_mode"
CONF_COLD_TOLERANCE = "cold_tolerance" CONF_COLD_TOLERANCE = "cold_tolerance"
CONF_HEATER = "heater" CONF_HEATER = "heater"
CONF_HOT_TOLERANCE = "hot_tolerance" CONF_HOT_TOLERANCE = "hot_tolerance"
CONF_MAX_TEMP = "max_temp"
CONF_MIN_DUR = "min_cycle_duration" CONF_MIN_DUR = "min_cycle_duration"
CONF_MIN_TEMP = "min_temp"
CONF_PRESETS = { CONF_PRESETS = {
p: f"{p}_temp" p: f"{p}_temp"
for p in ( for p in (

View File

@ -12,7 +12,9 @@
"min_cycle_duration": "Minimum cycle duration", "min_cycle_duration": "Minimum cycle duration",
"name": "[%key:common::config_flow::data::name%]", "name": "[%key:common::config_flow::data::name%]",
"cold_tolerance": "Cold tolerance", "cold_tolerance": "Cold tolerance",
"hot_tolerance": "Hot tolerance" "hot_tolerance": "Hot tolerance",
"min_temp": "Minimum target temperature",
"max_temp": "Maximum target temperature"
}, },
"data_description": { "data_description": {
"ac_mode": "Set the actuator specified to be treated as a cooling device instead of a heating device.", "ac_mode": "Set the actuator specified to be treated as a cooling device instead of a heating device.",
@ -45,7 +47,9 @@
"target_sensor": "[%key:component::generic_thermostat::config::step::user::data::target_sensor%]", "target_sensor": "[%key:component::generic_thermostat::config::step::user::data::target_sensor%]",
"min_cycle_duration": "[%key:component::generic_thermostat::config::step::user::data::min_cycle_duration%]", "min_cycle_duration": "[%key:component::generic_thermostat::config::step::user::data::min_cycle_duration%]",
"cold_tolerance": "[%key:component::generic_thermostat::config::step::user::data::cold_tolerance%]", "cold_tolerance": "[%key:component::generic_thermostat::config::step::user::data::cold_tolerance%]",
"hot_tolerance": "[%key:component::generic_thermostat::config::step::user::data::hot_tolerance%]" "hot_tolerance": "[%key:component::generic_thermostat::config::step::user::data::hot_tolerance%]",
"min_temp": "[%key:component::generic_thermostat::config::step::user::data::min_temp%]",
"max_temp": "[%key:component::generic_thermostat::config::step::user::data::max_temp%]"
}, },
"data_description": { "data_description": {
"heater": "[%key:component::generic_thermostat::config::step::user::data_description::heater%]", "heater": "[%key:component::generic_thermostat::config::step::user::data_description::heater%]",