Skip to content

Instantly share code, notes, and snippets.

@fosron
Forked from r3mcos3/heating.yaml
Last active February 26, 2025 09:26
Show Gist options
  • Save fosron/ef14609a66c045c63921be9dc89f90b8 to your computer and use it in GitHub Desktop.
Save fosron/ef14609a66c045c63921be9dc89f90b8 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint For Heating
blueprint:
name: Heating Control (Basic Switch with Hysteresis & Global Heating Season)
description: >
Control your heating switch based on a lower and an upper temperature threshold,
a time window, and a global heating season condition. When the heating season is off,
the heating will be forced off across all zones.
domain: automation
input:
heating:
name: Heating Switch
description: The switch controlling your heating.
selector:
entity:
domain: switch
temp_sensor:
name: Temperature Sensor
description: Temperature sensor to check.
selector:
entity:
domain: sensor
device_class: temperature
heating_season:
name: Global Heating Season
description: >
Global condition for heating season. Heating control will only operate if this boolean is 'on'.
selector:
entity:
domain: input_boolean
min_temp:
name: Lower Temperature Threshold
description: >
If the temperature is below this value, the heating will turn on (when currently off)
provided the time condition is met.
default: 20
selector:
number:
min: 0
max: 40
step: 0.5
max_temp:
name: Upper Temperature Threshold
description: >
If the temperature rises above this value, the heating will turn off (when currently on).
default: 23
selector:
number:
min: 0
max: 40
step: 0.5
time_after:
name: Time After
description: >
The heating is allowed to operate only after this time.
default: '07:30:00'
selector:
time: {}
time_before:
name: Time Before
description: >
The heating is allowed to operate only before this time.
default: '23:59:00'
selector:
time: {}
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: time_pattern
minutes: '/10'
action:
- choose:
# First branch: If the global heating season is off, force heating off.
- conditions:
- condition: state
entity_id: !input heating_season
state: 'off'
sequence:
- service: switch.turn_off
target:
entity_id: !input heating
# Branch to turn heating on:
- conditions:
- condition: state
entity_id: !input heating_season
state: 'on'
- condition: state
entity_id: !input heating
state: 'off'
- condition: numeric_state
entity_id: !input temp_sensor
below: !input min_temp
- condition: time
after: !input time_after
before: !input time_before
sequence:
- service: switch.turn_on
target:
entity_id: !input heating
# Branch to turn heating off if conditions to stop heating are met:
- conditions:
- condition: state
entity_id: !input heating_season
state: 'on'
- condition: state
entity_id: !input heating
state: 'on'
- condition: or
conditions:
- condition: numeric_state
entity_id: !input temp_sensor
above: !input max_temp
- condition: not
conditions:
- condition: time
after: !input time_after
before: !input time_before
sequence:
- service: switch.turn_off
target:
entity_id: !input heating
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment