About a year or so ago, I moved away from HomeKit and starting using Home Assistant. HomeKit was just too unreliable when it came to automating things, not to mention that Siri is very moody about when it wants to work or not.
My Home Assistant setup now controls all my HomeKit, Zigbee, and Z-Wave devices and they are all exposed back to HomeKit so I can use Siri for voice control. I must say, that I am pretty impressed with the setup and its reliability.
But, we are here to talk about your home’s climate control, so let’s begin.
I live in Montreal and the weather here gets pretty darn cold in the Winter which means high electricity bills. To that end our utility company, Hydro Quebec, has started new programs for peak hours to let folks lower their electricity bills and I am participating in that. The way it works is that they send an email the day before to tell you that tomorrow there may be a peak event during the morning, evening or both. So, I wanted a way to automate it all so I don’t have to adjust things manually.
The Setup
My home heating is with forced air, but I do have a few baseboard heaters around and floor heaters in the bathrooms, so they all have to work in concert.
- Main HVAC: Ecobee3
- Baseboard heaters (mix of Z-Wave, and HomeKit)
- Floor heaters (Zigbee)
- Gmail for peak event notifications
The Goal
Below is what I set out to achieve:
- Climate settings should have Home, Away, Sleep settings
- Climate settings should take into account peak events
- Climate settings should differentiate between workdays and weekends/holidays
- Climate settings should be aware of Summer/Winter temperatures
- All of the above should be easily adjustable.
How it works
In order to do all the goals I had set, the first thing was to take away the Ecobee’s programming, so I changed a few settings:
- Everyday of the week is only set to have 1 comfort setting which is the temperature range that I use for both Winter/Summer
- The hold setting is set to not change automatically, so if I change the temperature, it will keep that until I manually change it again.
Side Note: As much as I love the Ecobee, there is no way to have it resume unless you use it with HomeKit directly (i.e. only the Ecobee itself can add the resume to HomeKit, there is no HomeKit command for it). Also, I don’t like that it communicates with home base so much but I want the wether so I don’t like to let it know if I am home/away/on holiday.
One other item I should point out is that the way I prep for a peak time is that I preheat my house prior to peak time and then turn everything down for the duration so heating is used less and hopefully the house can stay somewhat warm during the event.
From this point on, I am going to refer to the file attached here and explain how it works. I think that would be best.
Adjustable Settings
The following is a list of inputs I used to achieve gaol #5:
- input_datetime
- peak_morning_start_time: The time that a morning peak event starts
- peak_morning_end_time: The time that a morning peak event ends
- peak_evening_start_time: The time that a evening peak event starts
- peak_evening_end_time: The time that a evening peak event ends
- input_number
- peak_pre_time (range 0-180 min): The time needed to preheat the home prior to a peak event
- winter_summer_threshold (range (-10 to 10 ºC): The temperature above which summer settings should be used.
- input_boolean
- peak_demand_morning_today: Whether today has a morning peak event
- peak_demand_evening_today: Whether today has a evening peak event
- peak_demand_morning_tomorrow: Whether tomorrow has a morning peak event
- peak_demand_evening_tomorrow: Whether tomorrow has a evening peak event
Besides the above, there are a few other things that are also leveraged:
- work_wakeup_time: The time that the house wakes up for a work day
- work_quiet_time: The time that the house is in sleep mode for a work day
- holiday_wakeup_time: The time that the house wakes up for a holiday (or weekend)
- holiday_quiet_time: The time that the house is in sleep mode for a holiday (or weekend)
- workday
- workday_today: Whether it is a work day today
- workday_tomorrow: Whether it is a work day tomorrow.
- IMAP Email Content: To check email for peak time (Note: I get this in English)
- peak_demand_morning_notification: a sensor that is set when a peak time email is received containing peak time for tomorrow morning.
- peak_demand_evening_notification: a sensor that is set when a peak time email is received containing peak time for tomorrow evening.
- household: This is a group of household members that indicates if we are home or not using sensors for each person.
- peak_time_now: A sensor indicating whether we are in a peak time at this moment.
- house_mode: A sensor indicating whether the house is in Home, Sleep, or Away mode. This is dependent on whether household is home or away and whether tomorrow and today are workdays or not (if tomorrow is not a workday, then the house goes to sleep mode at holiday_quiet_time instead of workday_quiet_time).
Implementation
The climate settings are controlled via scenes:
- Climate: Main Thermostat Away: This scene sets the temperature range for the Ecobee when we are away. The Ecobee is set to auto cool/heat and the range is such that it is the same for Summer and Winter.
- Climate: Main Thermostat Home: This scene sets the temperature range for the Ecobee when we are home.
- Climate: Main Thermostat Sleep: This scene sets the temperature range for the Ecobee when we are asleep.
- Climate: Other Thermostats Summer: This scene sets the temperature for each of the baseboard and floor heaters for the Summer time. Basically, turns them off.
- Climate: Other Thermostats Away – Winter: This scene sets the temperature for each of the baseboard and floor heaters for the Winter when the household is away.
- Climate: Other Thermostats Home – Winter: This scene sets the temperature for each of the baseboard and floor heaters for the Winter when the household is home.
- Climate: Other Thermostats Sleep – Winter: This scene sets the temperature for each of the baseboard and floor heaters for the Winter when the household is asleep.
- Climate: All Thermostats Peak Time: This scene sets the temperature for all (including Ecobee) heaters while we are in peak time.
Since the email for peak time comes the day before, the email sensor checks and set tomorrow’s peak inputs first (hydro_email). Then at 1AM, an automation copies the values to today’s peak input and resets tomorrow’s peak inputs back to off (Peak Time: Copy tomorrows values).
Then depending on whether it is a workday, holiday, or peak time automations control the heaters:
- Climate: Preheat at morning peak start time: This automation triggers at preheat time (peak start time – preheat time) only if there is a morning peak event, and household is home to make sure the house is heated and ready to use less heating during the morning peak time.
- Scene: Climate: Main Thermostat Home
- Scene: Climate: Other Thermostats Home – Winter
- Climate: Preheat at evening peak start time: Same as the morning automation but for the evening peak time
- Scene: Climate: Main Thermostat Home
- Scene: Climate: Other Thermostats Home – Winter
- Climate: Set peak mode at peak start time: This automation is triggered when the peak_time_now sensor is turned on and household is home
- Scene: Climate: All Thermostats Peak Time
- Climate: Reset peak mode at peak end time: This automation reset the climate settings to what they should be once peak time is over (i.e. if house_mode is set to sleep, then set the sleep time settings , etc).
- If home:
- Scene: Climate: Main Thermostat Home
- Scene: Climate: Other Thermostats Home – Winter
- If asleep:
- Scene: Climate: Main Thermostat Sleep
- Scene: Climate: Other Thermostats Sleep – Winter
- Otherwise:
- Scene: Climate: Main Thermostat Away
- Scene: Climate: Other Thermostats Away – Winter
- If home:
- Climate: Preheat before morning wake time or at wake time: This automation sets the climate settings to home at preheat time or at wakeup time if household is home and it is not a peak_time_now.
- Scene: Climate: Main Thermostat Home
- If temperature is below threshold (winter_summer_threshold):
- Scene: Climate: Other Thermostats Home – Winter
- Otherwise:
- Scene: Climate: Other Thermostats Summer
- Climate: Pre Cool or stop heating before sleep time or at sleep time: This automation sets the climate settings to sleep at preheat time or at sleep time if household is home and it is not a peak_time_now.
- Scene: Climate: Main Thermostat Sleep
- If temperature is below threshold (winter_summer_threshold):
- Scene: Climate: Other Thermostats Sleep – Winter
- Otherwise:
- Scene: Climate: Other Thermostats Summer
- Climate: Household leaves: This automation sets the climate settings to away when household is not home.
- Scene: Climate: Main Thermostat Away
- If temperature is below threshold (winter_summer_threshold):
- Scene: Climate: Other Thermostats Away – Winter
- Otherwise:
- Scene: Climate: Other Thermostats Summer
- Climate: Household arrives: This automation sets the climate settings to home when household comes home (i.e. first person arrives home).
- If house_mode is set to sleep:
- Scene: Climate: Main Thermostat Sleep
- If temperature is below threshold (winter_summer_threshold):
- Scene: Climate: Other Thermostats Sleep – Winter
- Otherwise:
- Scene: Climate: Main Thermostat Home
- If temperature is below threshold (winter_summer_threshold):
- Scene: Climate: Other Thermostats Home – Winter
- Otherwise:
- Scene: Climate: Other Thermostats Summer
- If house_mode is set to sleep:
YAML
here is the Yaml for the above so you can see how it is implemented exactly. Note that some inputs/sensors are external to this file but they are explained in here so you know what they do.
input_datetime:
# This indicates the start time of peak demand time in the morning
peak_morning_start_time:
name: Peak Demand Morning Start
has_date: false
has_time: true
icon: mdi:clock-time-six
# This indicates the end time of peak demand time in the morning
peak_morning_end_time:
name: Peak Demand Morning End
has_date: false
has_time: true
icon: mdi:clock-time-nine
# This indicates the start time of peak demand time in the evening
peak_evening_start_time:
name: Peak Demand Evening Start
has_date: false
has_time: true
icon: mdi:clock-time-four-outline
# This indicates the end time of peak demand time in the evening
peak_evening_end_time:
name: Peak Demand Evening End
has_date: false
has_time: true
icon: mdi:clock-time-eight-outline
input_number:
# This input sets the time needed to cool/heat the house prior to Peak time
peak_pre_time:
name: Peak Pre Time
min: 0
max: 180
step: 5
mode: slider
icon: mdi:timelapse
winter_summer_threshold:
name: Winter/Summer Threshold
min: -10
max: 10
step: 1
mode: slider
icon: mdi:car-speed-limiter
input_boolean:
# This input determines whether peak demand morning time is enabled for today or not
peak_demand_morning_today:
name: Peak Demand Morning Today
icon: mdi:summit
# This input determines whether peak demand evening time is enabled for today or not
peak_demand_evening_today:
name: Peak Demand Evening Today
icon: mdi:summit
# This input determines whether peak demand morning time is enabled for tomorrow or not
peak_demand_morning_tomorrow:
name: Peak Demand Morning Tomorrow
icon: mdi:summit
# This input determines whether peak demand evening time is enabled for tomorrow or not
peak_demand_evening_tomorrow:
name: Peak Demand Evening Tomorrow
icon: mdi:summit
sensor:
# https://www.home-assistant.io/integrations/imap_email_content/
- platform: imap_email_content
name: hydro_email
server: imap.gmail.com
port: 993
username: !secret peak_email_username
password: !secret peak_email_password
senders:
- hydroquebec@communication.hydroquebec.com
value_template: >-
{% if ( 'Peak demand event notification' in subject) %}
peak
{% else %}
off
{% endif %}
- platform: template
sensors:
peak_demand_morning_notification:
friendly_name: "Peak Demand Morning Notification" #Thu, 20 Jan 2022 12:52:16 -0500
value_template: >-
{% if ( states('sensor.hydro_email') == 'peak' and strptime(state_attr('sensor.hydro_email','date'), '%a, %d %b %Y %H:%M:%S %z').strftime('%d%m%Y') == now().strftime('%d%m%Y') and state_attr('sensor.hydro_email','body') is search('from 6 to 9 a.m.', ignorecase=True) ) %}
on
{% else %}
off
{% endif %}
peak_demand_evening_notification:
friendly_name: "Peak Demand Evening Notification"
value_template: >-
{% if ( states('sensor.hydro_email') == 'peak' and strptime(state_attr('sensor.hydro_email','date'), '%a, %d %b %Y %H:%M:%S %z').strftime('%d%m%Y') == now().strftime('%d%m%Y') and state_attr('sensor.hydro_email','body') is search('from 4 to 8 p.m.', ignorecase=True) ) %}
on
{% else %}
off
{% endif %}
peak_time_now:
friendly_name: "Peak Time Now"
value_template: >-
{% if ( is_state('input_boolean.peak_demand_morning_today', 'on') and
now().strftime('%H:%M') >= (state_attr('input_datetime.peak_morning_start_time', 'timestamp') | timestamp_custom('%H:%M', False)) and
now().strftime('%H:%M') <= (state_attr('input_datetime.peak_morning_end_time', 'timestamp') | timestamp_custom('%H:%M', False)) ) or
( is_state('input_boolean.peak_demand_evening_today', 'on') and
now().strftime('%H:%M') >= (state_attr('input_datetime.peak_evening_start_time', 'timestamp') | timestamp_custom('%H:%M', False)) and
now().strftime('%H:%M') <= (state_attr('input_datetime.peak_evening_end_time', 'timestamp') | timestamp_custom('%H:%M', False)) ) %}
on
{% else %}
off
{% endif %}
scene:
######
# Climate: Main Thermostat Away
- name: "Climate: Main Thermostat Away"
id: bb18cf20-57ae-47e3-a80e-c9896745673f
entities:
climate.sedhvac:
state: "heat_cool"
target_temp_high: 29
target_temp_low: 14
#####
# Climate: Main Thermostat Home
- name: "Climate: Main Thermostat Home"
id: bab27c18-3237-4a0b-83f9-6606865e0ec9
entities:
climate.sedhvac:
state: "heat_cool"
target_temp_high: 25
target_temp_low: 19.5
#####
# Climate: Main Thermostat Sleep
- name: "Climate: Main Thermostat Sleep"
id: b0d722cc-8480-4229-a07c-7ae21309945a
entities:
climate.sedhvac:
state: "heat_cool"
target_temp_high: 23.5
target_temp_low: 17.5
######
# Climate: Other Thermostats Summer
- name: "Climate: Other Thermostats Summer"
id: 68cb636e-b76d-4148-93cf-cc65e8d6f45c
entities:
climate.bedroom3_thermostat:
state: "heat"
temperature: 6
climate.guest_bedroom_thermostat:
state: "heat"
temperature: 6
climate.family_room_thermostat:
state: "off"
climate.garage_thermostat:
state: "off"
climate.downstairs_bathroom_thermostat:
state: "off"
climate.master_bathroom_thermostat:
state: "off"
climate.upstairs_bathroom_thermostat:
state: "off"
######
# Climate: Other Thermostats Away - Winter
- name: "Climate: Other Thermostats Away - Winter"
id: d86d5909-8eb2-4dd2-a51f-8aae0599a0c6
entities:
climate.bedroom3_thermostat:
state: "heat"
temperature: 12
climate.guest_bedroom_thermostat:
state: "heat"
temperature: 12
climate.family_room_thermostat:
state: "heat"
temperature: 12
climate.garage_thermostat:
state: "heat"
temperature: 8
climate.downstairs_bathroom_thermostat:
state: "heat"
temperature: 12
climate.master_bathroom_thermostat:
state: "heat"
temperature: 12
climate.upstairs_bathroom_thermostat:
state: "heat"
temperature: 12
#####
# Climate: Other Thermostats Home - Winter
- name: "Climate: Other Thermostats Home - Winter"
id: 411533f6-ef26-450b-9acb-2e44a4c5cd50
entities:
climate.bedroom3_thermostat:
state: "heat"
temperature: 18
climate.family_room_thermostat:
state: "heat"
temperature: 18
climate.guest_bedroom_thermostat:
state: "heat"
temperature: 18
climate.garage_thermostat:
state: "heat"
temperature: 14
climate.downstairs_bathroom_thermostat:
state: "heat"
temperature: 20
climate.master_bathroom_thermostat:
state: "heat"
temperature: 20
climate.upstairs_bathroom_thermostat:
state: "heat"
temperature: 20
#####
# Climate: Other Thermostats Sleep - Winter
- name: "Climate: Other Thermostats Sleep - Winter"
id: 4b8b86c5-035a-4b8b-a934-f31571cd71e6
entities:
climate.bedroom3_thermostat:
state: "heat"
temperature: 17
climate.family_room_thermostat:
state: "heat"
temperature: 17
climate.guest_bedroom_thermostat:
state: "heat"
temperature: 17
climate.garage_thermostat:
state: "heat"
temperature: 12
climate.downstairs_bathroom_thermostat:
state: "heat"
temperature: 18
climate.master_bathroom_thermostat:
state: "heat"
temperature: 18
climate.upstairs_bathroom_thermostat:
state: "heat"
temperature: 18
#####
# Climate: All Thermostats Peak Time
- name: "Climate: All Thermostats Peak Time"
id: 794a89e7-1ecc-4e02-977b-21a0e8260b0f
entities:
climate.sedhvac:
state: "heat_cool"
target_temp_high: 25
target_temp_low: 18
climate.bedroom3_thermostat:
state: "heat"
temperature: 17
climate.family_room_thermostat:
state: "heat"
temperature: 17
climate.guest_bedroom_thermostat:
state: "heat"
temperature: 15
climate.garage_thermostat:
state: "heat"
temperature: 10
climate.downstairs_bathroom_thermostat:
state: "heat"
temperature: 17
climate.master_bathroom_thermostat:
state: "heat"
temperature: 17
climate.upstairs_bathroom_thermostat:
state: "heat"
temperature: 17
automation:
######
# Climate: Preheat at morning peak start time
- alias: "Climate: Preheat at morning peak start time"
id: "7e432873-c8b7-4d75-9ff4-cfb3c6753bc6"
description: ""
mode: single
trigger:
- platform: template
value_template: "{{ states('sensor.time') == ((state_attr('input_datetime.peak_morning_start_time', 'timestamp') - (states('input_number.peak_pre_time')|float * 60) ) | timestamp_custom('%H:%M', False)) }}"
condition:
alias: Household is home and today is peak time
condition: and
conditions:
- condition: state
entity_id: input_boolean.peak_demand_morning_today
state: "on"
- condition: state
entity_id: group.household
state: "home"
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
action:
- scene: scene.climate_main_thermostat_home
- scene: scene.climate_other_thermostats_home_winter
######
# limate: Preheat at evening peak start time
- alias: "Climate: Preheat at evening peak start time"
id: "5310be81-0d3d-4a82-baf6-e4c455e5beb5"
description: ""
mode: single
trigger:
- platform: template
value_template: "{{ states('sensor.time') == ((state_attr('input_datetime.peak_evening_start_time', 'timestamp') - (states('input_number.peak_pre_time')|float * 60) ) | timestamp_custom('%H:%M', False)) }}"
condition:
alias: Household is home and today is peak time
condition: and
conditions:
- condition: state
entity_id: input_boolean.peak_demand_evening_today
state: "on"
- condition: state
entity_id: group.household
state: "home"
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
action:
- scene: scene.climate_main_thermostat_home
- scene: scene.climate_other_thermostats_home_winter
######
# Climate: Set peak mode at peak start time
- alias: "Climate: Set peak mode at peak start time"
id: "f2a9c6d3-6e3c-46bd-a72f-843c48e6ba80"
description: ""
mode: single
trigger:
- platform: state
entity_id: sensor.peak_time_now
from: "off"
to: "on"
condition:
# if it is peak time then the temp must be below threshold, but we check anyways
alias: Only do this if the temperature is below threshold and household is home
condition: and
conditions:
- condition: state
entity_id: group.household
state: "home"
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
action:
- scene: scene.climate_all_thermostats_peak_time
######
# Climate: Reset peak mode at evening peak end time
- alias: "Climate: Reset peak mode at peak end time"
id: "957f2036-23a9-42c2-92e5-bb03cf7445eb"
description: ""
mode: single
trigger:
- platform: state
entity_id: sensor.peak_time_now
from: "on"
to: "off"
condition: []
action:
- alias: Set home/sleep/away mode appropriately
choose:
- conditions:
- condition: state
entity_id: sensor.house_mode
state: "Home"
sequence:
- scene: scene.climate_main_thermostat_home
- scene: scene.climate_other_thermostats_home_winter
- conditions:
- condition: state
entity_id: sensor.house_mode
state: "Sleep"
sequence:
- scene: scene.climate_main_thermostat_sleep_2
- scene: scene.climate_other_thermostats_sleep_winter
default:
- scene: scene.climate_main_thermostat_away
- scene: scene.climate_other_thermostats_away_winter
######
# Climate: Preheat before morning wake time or at wake time
- alias: "Climate: Preheat before morning wake time or at wake time"
id: "e950b43b-0314-4f9b-9092-08cfd87e9b74"
description: ""
mode: single
trigger:
- platform: template
value_template: "{{ states('binary_sensor.workday_today') == 'off' and states('sensor.time') == ((state_attr('input_datetime.holiday_wakeup_time', 'timestamp') - (states('input_number.peak_pre_time')|float * 60) ) | timestamp_custom('%H:%M', False)) }}"
- platform: template
value_template: "{{ states('binary_sensor.workday_today') == 'on' and states('sensor.time') == ((state_attr('input_datetime.work_wakeup_time', 'timestamp') - (states('input_number.peak_pre_time')|float * 60) ) | timestamp_custom('%H:%M', False)) }}"
- platform: template
value_template: "{{ states('binary_sensor.workday_today') == 'off' and states('sensor.time') == ( state_attr('input_datetime.holiday_wakeup_time', 'timestamp') | timestamp_custom('%H:%M', False) ) }}"
- platform: template
value_template: "{{ states('binary_sensor.workday_today') == 'on' and states('sensor.time') == ( state_attr('input_datetime.work_wakeup_time', 'timestamp') | timestamp_custom('%H:%M', False) ) }}"
condition:
alias: Household is home and NOT peak time now
condition: and
conditions:
- condition: state
entity_id: sensor.peak_time_now
state: "off"
- condition: state
entity_id: group.household
state: "home"
action:
- scene: scene.climate_main_thermostat_home
- alias: Also set the other thermostats if temp is below threshold
choose:
- conditions:
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
sequence:
- scene: scene.climate_other_thermostats_home_winter
default:
- scene: scene.climate_other_thermostats_summer
######
# Climate: Pre Cool or stop heating before sleep time or at sleep time
- alias: "Climate: Pre Cool or stop heating before sleep time or at sleep time"
id: "9684f644-4b38-4782-8de5-3d81c3448622"
description: ""
mode: single
trigger:
- platform: template
value_template: "{{ states('binary_sensor.workday_tomorrow') == 'off' and states('sensor.time') == ((state_attr('input_datetime.holiday_quiet_time', 'timestamp') - (states('input_number.peak_pre_time')|float * 60) ) | timestamp_custom('%H:%M', False)) }}"
- platform: template
value_template: "{{ states('binary_sensor.workday_tomorrow') == 'on' and states('sensor.time') == ((state_attr('input_datetime.work_quiet_time', 'timestamp') - (states('input_number.peak_pre_time')|float * 60) ) | timestamp_custom('%H:%M', False)) }}"
- platform: template
value_template: "{{ states('binary_sensor.workday_tomorrow') == 'off' and states('sensor.time') == ( state_attr('input_datetime.holiday_quiet_time', 'timestamp') | timestamp_custom('%H:%M', False) ) }}"
- platform: template
value_template: "{{ states('binary_sensor.workday_tomorrow') == 'on' and states('sensor.time') == ( state_attr('input_datetime.work_quiet_time', 'timestamp') | timestamp_custom('%H:%M', False) ) }}"
condition:
alias: Household is home and NOT peak time now
condition: and
conditions:
- condition: state
entity_id: sensor.peak_time_now
state: "off"
- condition: state
entity_id: group.household
state: "home"
action:
- scene: scene.climate_main_thermostat_sleep_2
- alias: Also set the other thermostats if temp is below threshold
choose:
- conditions:
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
sequence:
- scene: scene.climate_other_thermostats_sleep_winter
default:
- scene: scene.climate_other_thermostats_summer
######
# Peak Time: Set tomorrow's morning values
- alias: "Peak Time: Set tomorrows morning value"
id: "ebf235ee-74cf-45d4-8eec-054eb3c03e6a"
description: ""
mode: single
trigger:
- platform: state
entity_id: sensor.peak_demand_morning_notification
from: "off"
to: "on"
condition: []
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.peak_demand_morning_tomorrow
######
# Peak Time: Set tomorrow's evening values
- alias: "Peak Time: Set tomorrows evening value"
id: "73f52595-c64e-41ea-b437-aa13272ffb31"
description: ""
mode: single
trigger:
- platform: state
entity_id: sensor.peak_demand_evening_notification
from: "off"
to: "on"
condition: []
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.peak_demand_evening_tomorrow
######
# Peak Time: Copy tomorrow's values
- alias: "Peak Time: Copy tomorrows values"
id: "0dd12a22-7418-426a-9439-402cce7bb7e5"
description: ""
mode: single
trigger:
- platform: time
at: 00:01:00
condition: []
action:
- alias: Copy morning value and set tomorrow to off
choose:
- conditions:
- condition: state
entity_id: input_boolean.peak_demand_morning_tomorrow
state: "on"
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.peak_demand_morning_today
default:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.peak_demand_morning_today
- alias: Copy evening value and set tomorrow to off
choose:
- conditions:
- condition: state
entity_id: input_boolean.peak_demand_evening_tomorrow
state: "on"
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.peak_demand_evening_today
default:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.peak_demand_evening_today
- service: input_boolean.turn_off
target:
entity_id: input_boolean.peak_demand_morning_tomorrow
- service: input_boolean.turn_off
target:
entity_id: input_boolean.peak_demand_evening_tomorrow
######
# Climate: Household leaves
- alias: "Climate: Household leaves"
id: 0e666717-db83-4d67-b784-eca6edc92431
description: When everyone leaves
mode: single
trigger:
- platform: state
entity_id: group.household
from: home
to: not_home
condition: []
action:
- scene: scene.climate_main_thermostat_away
- alias: Also set the other thermostats if temp is below threshold
choose:
- conditions:
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
sequence:
- scene: scene.climate_other_thermostats_away_winter
default:
- scene: scene.climate_other_thermostats_summer
######
# Climate: Household Arrives
- alias: "Climate: Household Arrives"
id: 0c6be006-26e6-4d15-b6d4-0615c3aca80f
description: When first person arrives
mode: single
trigger:
- platform: state
entity_id: group.household
from: not_home
to: home
condition: []
action:
- alias: For the main thermostat, if it is past sleep time, then set to sleep, otherwise home
choose:
- conditions:
- condition: state
entity_id: sensor.house_mode
state: "Sleep"
sequence:
- scene: scene.climate_main_thermostat_sleep_2
default:
- scene: scene.climate_main_thermostat_home
- scene: scene.mm_monitor_on
- alias: Also set the other thermostats depending on sleep mode and current temperature
choose:
- conditions:
- condition: state
entity_id: sensor.house_mode
state: "Sleep"
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
sequence:
- scene: scene.climate_other_thermostats_sleep_winter
- conditions:
- condition: state
entity_id: sensor.house_mode
state: "Home"
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < (states('input_number.winter_summer_threshold')|float) }}"
sequence:
- scene: scene.climate_other_thermostats_home_winter
default:
- scene: scene.climate_other_thermostats_summer