Skip to content

Commit

Permalink
Generic Thermostat Add Target Min Max to UI config (home-assistant#13…
Browse files Browse the repository at this point in the history
…1168)

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.
  • Loading branch information
hughsaunders authored Dec 3, 2024
1 parent a405d2b commit bb51837
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/generic_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
CONF_COLD_TOLERANCE,
CONF_HEATER,
CONF_HOT_TOLERANCE,
CONF_MAX_TEMP,
CONF_MIN_DUR,
CONF_MIN_TEMP,
CONF_PRESETS,
CONF_SENSOR,
DEFAULT_TOLERANCE,
Expand All @@ -77,8 +79,6 @@

CONF_INITIAL_HVAC_MODE = "initial_hvac_mode"
CONF_KEEP_ALIVE = "keep_alive"
CONF_MIN_TEMP = "min_temp"
CONF_MAX_TEMP = "max_temp"
CONF_PRECISION = "precision"
CONF_TARGET_TEMP = "target_temp"
CONF_TEMP_STEP = "target_temp_step"
Expand Down
12 changes: 12 additions & 0 deletions homeassistant/components/generic_thermostat/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
CONF_COLD_TOLERANCE,
CONF_HEATER,
CONF_HOT_TOLERANCE,
CONF_MAX_TEMP,
CONF_MIN_DUR,
CONF_MIN_TEMP,
CONF_PRESETS,
CONF_SENSOR,
DEFAULT_TOLERANCE,
Expand Down Expand Up @@ -57,6 +59,16 @@
vol.Optional(CONF_MIN_DUR): selector.DurationSelector(
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 = {
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/generic_thermostat/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
CONF_COLD_TOLERANCE = "cold_tolerance"
CONF_HEATER = "heater"
CONF_HOT_TOLERANCE = "hot_tolerance"
CONF_MAX_TEMP = "max_temp"
CONF_MIN_DUR = "min_cycle_duration"
CONF_MIN_TEMP = "min_temp"
CONF_PRESETS = {
p: f"{p}_temp"
for p in (
Expand Down
8 changes: 6 additions & 2 deletions homeassistant/components/generic_thermostat/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"min_cycle_duration": "Minimum cycle duration",
"name": "[%key:common::config_flow::data::name%]",
"cold_tolerance": "Cold tolerance",
"hot_tolerance": "Hot tolerance"
"hot_tolerance": "Hot tolerance",
"min_temp": "Minimum target temperature",
"max_temp": "Maximum target temperature"
},
"data_description": {
"ac_mode": "Set the actuator specified to be treated as a cooling device instead of a heating device.",
Expand Down Expand Up @@ -45,7 +47,9 @@
"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%]",
"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": {
"heater": "[%key:component::generic_thermostat::config::step::user::data_description::heater%]",
Expand Down

0 comments on commit bb51837

Please sign in to comment.