home-assistant/automations/ac_peak_setback.yaml

63 lines
2.7 KiB
YAML
Raw Normal View History

# ac_peak_setback — hold the house warm during the on-peak window (both seasons)
#
# id / entity : ac_peak_setback -> automation.ac_peak_setback_to_82
# triggers : 14:00 (id: summer) and 17:00 (id: winter), local time
# purpose : Coast through the utility on-peak by setting the AC to 82F.
#
# Self-selecting by season (Pepco MD TOU-P peak windows):
# * summer (Jun-Sep): on-peak 14:00-19:00 -> the 14:00 trigger applies.
# * winter (Oct-May): evening on-peak 17:00-21:00 -> the 17:00 trigger applies.
# A trigger only acts when trigger.id == the current season, so the "wrong"
# time is a no-op.
#
# Safety: winter is COOLING-ONLY. Heat is gas (not on this electric peak logic),
# so winter never forces cool mode — it only nudges the setpoint when the
# thermostat is already in `cool`. Summer forces cool mode as before.
#
# Fallbacks: workday sensor unavailable -> Mon-Fri (see is_workday).
#
# Setpoints come from the `params` map so summer/winter can diverge later.
#
# v3 (2026-07-09): unified summer+winter, season params map, winter cooling-only.
id: ac_peak_setback
alias: AC - Peak setback to 82
description: >-
v3 (2026-07-09). On work days, sets the AC to 82F to coast through the on-peak
window: summer 2pm (14:00-19:00 peak) and winter 5pm (17:00-21:00 peak).
Winter is cooling-only (never touches gas heat). Falls back to Mon-Fri if the
workday sensor fails. Managed in git; see AUTOMATIONS.md.
mode: single
triggers:
- trigger: time
at: "14:00:00"
id: summer
- trigger: time
at: "17:00:00"
id: winter
conditions: []
actions:
- variables:
season: "{{ 'summer' if now().month in [6,7,8,9] else 'winter' }}"
is_workday: "{% set wd = states('binary_sensor.workday_sensor') %}{% if wd in ['on','off'] %}{{ wd == 'on' }}{% else %}{{ now().weekday() < 5 }}{% endif %}"
cooling: "{{ is_state('climate.t6_pro_z_wave_programmable_thermostat_with_smartstart','cool') }}"
params: "{{ {'summer': {'hold': 82, 'ret': 74}, 'winter': {'hold': 82, 'ret': 74}} }}"
applies: "{{ trigger.id == season }}"
- if:
- condition: template
value_template: "{{ applies and is_workday and (season == 'summer' or cooling) }}"
then:
- if:
- condition: template
value_template: "{{ season == 'summer' }}"
then:
- action: climate.set_hvac_mode
target:
entity_id: climate.t6_pro_z_wave_programmable_thermostat_with_smartstart
data:
hvac_mode: cool
- action: climate.set_temperature
target:
entity_id: climate.t6_pro_z_wave_programmable_thermostat_with_smartstart
data:
temperature: "{{ params[season]['hold'] }}"