Skip to content

Instantly share code, notes, and snippets.

@eugenk
Forked from r3mcos3/heating.yaml
Last active January 12, 2022 21:14
Show Gist options
  • Save eugenk/265966654ee73f3e9ba5a5209272e445 to your computer and use it in GitHub Desktop.
Save eugenk/265966654ee73f3e9ba5a5209272e445 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint For Heating
blueprint:
name: Heating Control using Time of Day
description: Controls the heating by presence and time of day
domain: automation
input:
heating:
name: Climate Device
description: The climate device to use.
selector:
entity:
domain: climate
anyone_home:
name: Anyone Home State
description: A binary sonsor telling whether or not anyone is home.
selector:
entity:
domain: binary_sensor
leaving_home_threshold_minutes:
name: No One Home Threshold
description: The number of minutes that no one is home after which to turn down the heating.
selector:
number:
min: 0
max: 180
mode: box
unit_of_measurement: minutes
time_of_day_is_day:
name: Time of day sensor for the time "day"
description: >
When this gets "on", the heating turns up. When this gets "off", the heating turns down. Create a "platform: tod" binary sensor for it.
selector:
entity:
domain: binary_sensor
temperature_day:
name: Daytime Temperature
description: The daytime temperature that the thermostat should hold. Create an Number helper (input_number entity) for it.
selector:
entity:
domain: input_number
temperature_night:
name: Nighttime Temperature
description: The nighttime temperature that the thermostat should hold. Create an Number helper (input_number entity) for it.
selector:
entity:
domain: input_number
variables:
temperature_night: !input temperature_night
temperature_day: !input temperature_day
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
entity_id: !input "anyone_home"
from: "off"
to: "on"
- platform: state
entity_id: !input "anyone_home"
from: "on"
to: "off"
for:
minutes: !input "leaving_home_threshold_minutes"
- platform: state
entity_id: !input "time_of_day_is_day"
action:
- choose:
- conditions:
- condition: state
entity_id: !input "time_of_day_is_day"
state: "on"
- condition: state
entity_id: !input "anyone_home"
state: "on"
sequence:
- service: climate.set_temperature
data:
entity_id: !input "heating"
temperature: "{{ states[temperature_day].state | float }}"
- conditions:
- condition: state
entity_id: !input "time_of_day_is_day"
state: "on"
- condition: not
conditions:
- condition: state
entity_id: !input "anyone_home"
state: "off"
for:
minutes: !input "leaving_home_threshold_minutes"
sequence:
- service: climate.set_temperature
data:
entity_id: !input "heating"
temperature: "{{ states[temperature_day].state | float }}"
default:
- service: climate.set_temperature
data:
entity_id: !input "heating"
temperature: "{{ states[temperature_night].state | float }}"
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment