mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 16:37:52 +01:00
Introduce cv.temperature_delta and fix problematic thermostat configuration behavior (#5297)
This commit is contained in:
parent
11ed2d5f18
commit
b20bae23cc
@ -591,11 +591,11 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_DEFAULT_TARGET_TEMPERATURE_LOW): cv.temperature,
|
||||
cv.Optional(
|
||||
CONF_SET_POINT_MINIMUM_DIFFERENTIAL, default=0.5
|
||||
): cv.temperature,
|
||||
cv.Optional(CONF_COOL_DEADBAND, default=0.5): cv.temperature,
|
||||
cv.Optional(CONF_COOL_OVERRUN, default=0.5): cv.temperature,
|
||||
cv.Optional(CONF_HEAT_DEADBAND, default=0.5): cv.temperature,
|
||||
cv.Optional(CONF_HEAT_OVERRUN, default=0.5): cv.temperature,
|
||||
): cv.temperature_delta,
|
||||
cv.Optional(CONF_COOL_DEADBAND, default=0.5): cv.temperature_delta,
|
||||
cv.Optional(CONF_COOL_OVERRUN, default=0.5): cv.temperature_delta,
|
||||
cv.Optional(CONF_HEAT_DEADBAND, default=0.5): cv.temperature_delta,
|
||||
cv.Optional(CONF_HEAT_OVERRUN, default=0.5): cv.temperature_delta,
|
||||
cv.Optional(CONF_MAX_COOLING_RUN_TIME): cv.positive_time_period_seconds,
|
||||
cv.Optional(CONF_MAX_HEATING_RUN_TIME): cv.positive_time_period_seconds,
|
||||
cv.Optional(CONF_MIN_COOLING_OFF_TIME): cv.positive_time_period_seconds,
|
||||
@ -608,8 +608,8 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_MIN_HEATING_OFF_TIME): cv.positive_time_period_seconds,
|
||||
cv.Optional(CONF_MIN_HEATING_RUN_TIME): cv.positive_time_period_seconds,
|
||||
cv.Required(CONF_MIN_IDLE_TIME): cv.positive_time_period_seconds,
|
||||
cv.Optional(CONF_SUPPLEMENTAL_COOLING_DELTA): cv.temperature,
|
||||
cv.Optional(CONF_SUPPLEMENTAL_HEATING_DELTA): cv.temperature,
|
||||
cv.Optional(CONF_SUPPLEMENTAL_COOLING_DELTA): cv.temperature_delta,
|
||||
cv.Optional(CONF_SUPPLEMENTAL_HEATING_DELTA): cv.temperature_delta,
|
||||
cv.Optional(
|
||||
CONF_FAN_ONLY_ACTION_USES_FAN_MODE_TIMER, default=False
|
||||
): cv.boolean,
|
||||
|
@ -929,6 +929,27 @@ def temperature(value):
|
||||
raise err
|
||||
|
||||
|
||||
def temperature_delta(value):
|
||||
err = None
|
||||
try:
|
||||
return _temperature_c(value)
|
||||
except Invalid as orig_err:
|
||||
err = orig_err
|
||||
|
||||
try:
|
||||
return _temperature_k(value)
|
||||
except Invalid:
|
||||
pass
|
||||
|
||||
try:
|
||||
fahrenheit = _temperature_f(value)
|
||||
return fahrenheit * (5 / 9)
|
||||
except Invalid:
|
||||
pass
|
||||
|
||||
raise err
|
||||
|
||||
|
||||
_color_temperature_mireds = float_with_unit("Color Temperature", r"(mireds|Mireds)")
|
||||
_color_temperature_kelvin = float_with_unit("Color Temperature", r"(K|Kelvin)")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user