mirror of
https://github.com/esphome/esphome.git
synced 2026-01-10 04:00:51 -07:00
Merge branch 'dev' into bump_libretiny_192
This commit is contained in:
@@ -153,6 +153,19 @@ def generate_comparable_preset(config, name):
|
|||||||
return comparable_preset
|
return comparable_preset
|
||||||
|
|
||||||
|
|
||||||
|
def validate_heat_cool_mode(value) -> list:
|
||||||
|
"""Validate heat_cool_mode - accepts either True or an automation."""
|
||||||
|
if value is True:
|
||||||
|
# Convert True to empty automation list
|
||||||
|
return []
|
||||||
|
if value is False:
|
||||||
|
raise cv.Invalid(
|
||||||
|
"heat_cool_mode cannot be 'false'. Specify 'true' to enable the mode or provide an automation"
|
||||||
|
)
|
||||||
|
# Otherwise validate as automation
|
||||||
|
return automation.validate_automation(single=True)(value)
|
||||||
|
|
||||||
|
|
||||||
def validate_thermostat(config):
|
def validate_thermostat(config):
|
||||||
# verify corresponding action(s) exist(s) for any defined climate mode or action
|
# verify corresponding action(s) exist(s) for any defined climate mode or action
|
||||||
requirements = {
|
requirements = {
|
||||||
@@ -554,9 +567,7 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
cv.Optional(CONF_FAN_ONLY_MODE): automation.validate_automation(
|
cv.Optional(CONF_FAN_ONLY_MODE): automation.validate_automation(
|
||||||
single=True
|
single=True
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_HEAT_COOL_MODE): automation.validate_automation(
|
cv.Optional(CONF_HEAT_COOL_MODE): validate_heat_cool_mode,
|
||||||
single=True
|
|
||||||
),
|
|
||||||
cv.Optional(CONF_HEAT_MODE): automation.validate_automation(single=True),
|
cv.Optional(CONF_HEAT_MODE): automation.validate_automation(single=True),
|
||||||
cv.Optional(CONF_OFF_MODE): automation.validate_automation(single=True),
|
cv.Optional(CONF_OFF_MODE): automation.validate_automation(single=True),
|
||||||
cv.Optional(CONF_FAN_MODE_ON_ACTION): automation.validate_automation(
|
cv.Optional(CONF_FAN_MODE_ON_ACTION): automation.validate_automation(
|
||||||
@@ -828,9 +839,11 @@ async def to_code(config):
|
|||||||
)
|
)
|
||||||
cg.add(var.set_supports_heat(True))
|
cg.add(var.set_supports_heat(True))
|
||||||
if CONF_HEAT_COOL_MODE in config:
|
if CONF_HEAT_COOL_MODE in config:
|
||||||
await automation.build_automation(
|
# Build automation only if user provided actions (not just `true`)
|
||||||
var.get_heat_cool_mode_trigger(), [], config[CONF_HEAT_COOL_MODE]
|
if config[CONF_HEAT_COOL_MODE]:
|
||||||
)
|
await automation.build_automation(
|
||||||
|
var.get_heat_cool_mode_trigger(), [], config[CONF_HEAT_COOL_MODE]
|
||||||
|
)
|
||||||
cg.add(var.set_supports_heat_cool(True))
|
cg.add(var.set_supports_heat_cool(True))
|
||||||
if CONF_OFF_MODE in config:
|
if CONF_OFF_MODE in config:
|
||||||
await automation.build_automation(
|
await automation.build_automation(
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ climate:
|
|||||||
- logger.log: dry_mode
|
- logger.log: dry_mode
|
||||||
fan_only_mode:
|
fan_only_mode:
|
||||||
- logger.log: fan_only_mode
|
- logger.log: fan_only_mode
|
||||||
|
heat_cool_mode: true
|
||||||
fan_mode_auto_action:
|
fan_mode_auto_action:
|
||||||
- logger.log: fan_mode_auto_action
|
- logger.log: fan_mode_auto_action
|
||||||
fan_mode_on_action:
|
fan_mode_on_action:
|
||||||
|
|||||||
Reference in New Issue
Block a user