home-assistant/automations/ac_peak_setback.yaml
jm 7a0d75d9db Add TOU winter peak-shaving; parameterize by season (v3)
Pepco MD TOU-P has different on-peak windows by season: summer (Jun-Sep)
14:00-19:00, winter (Oct-May) 06:00-09:00 and 17:00-21:00. Heat is gas, so
winter electric peak logic is cooling-only.

* pre-cool: bounded to summer (Jun-Sep); winter has no pre-cool.
* peak-setback (hold) and peak-ends (return): unified across seasons via a
  season self-select (month -> season; triggers carry id: summer/winter and act
  only when trigger.id == season) plus a params map for setpoints. Summer forces
  cool + 82 / returns 74 daily; winter sets 82 / returns 74 ONLY when already in
  cool mode, so it never disturbs the gas furnace.
* new ac_winter_morning_kill: 06:00 winter work days, if in cool mode set
  hvac_mode off to dodge the 6-9am winter peak. No auto-resume yet (planned).

Decision logic verified as a truth table via the template engine across
summer/winter x cooling x workday before commit. Deployed in place (existing
ids unchanged); new id ac_winter_morning_kill added.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 22:04:16 -04:00

62 lines
2.7 KiB
YAML

# 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'] }}"