Skip to content

Instantly share code, notes, and snippets.

@martintamare
Last active February 28, 2024 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martintamare/4d2fb9832b11908c716691b23a05098a to your computer and use it in GitHub Desktop.
Save martintamare/4d2fb9832b11908c716691b23a05098a to your computer and use it in GitHub Desktop.
Windows HVAC blueprint Home Assistant
blueprint:
name: Smart Thermostat for Windows
description: >-
Based on your window sensor this automation turns the thermostat on or off.
You can also specify the time that is needed to switch the state.
domain: automation
input:
window_sensor:
name: Window / Door Sensor
selector:
entity:
domain: binary_sensor
window_delay:
name: Window / Door Sensor Delay
description: "Time the sensor needs to stay the same after change to trigger the automation. This is done to avoid retriggering. (Default = 5s)"
default: 30
selector:
number:
mode: box
min: 0
max: 3600
unit_of_measurement: seconds
thermostat:
name: Thermostat
selector:
entity:
domain: climate
trigger:
- platform: state
entity_id: !input window_sensor
to: 'off'
from: 'on'
for: !input window_delay
- platform: state
entity_id: !input window_sensor
to: 'on'
from: 'off'
for: !input window_delay
action:
- choose:
- conditions:
- condition: and
conditions:
- condition: state
entity_id: !input window_sensor
state: 'off'
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: heat
entity_id: !input thermostat
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input window_sensor
state: 'on'
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: 'off'
entity_id: !input thermostat
default: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment