Skip to content

Instantly share code, notes, and snippets.

@quallenbezwinger
Last active July 11, 2023 11:12
Show Gist options
  • Save quallenbezwinger/8ba849b480844b32e9ca484e6de5d552 to your computer and use it in GitHub Desktop.
Save quallenbezwinger/8ba849b480844b32e9ca484e6de5d552 to your computer and use it in GitHub Desktop.
Homeassistant blueprint to switch heater on or off depending on window or door sensor
blueprint:
name: window controlled heater
description: turn on/off heater when opening/closing window or door sensor
domain: automation
source_url: https://gist.github.com/dirkk1980/8ba849b480844b32e9ca484e6de5d552
input:
heating_target:
name: Heater
selector:
entity:
domain: climate
#entity is not specified cause it should also be possible to use groups
window_entity:
name: Window Sensor
selector:
entity:
variables:
heating_target: !input heating_target
heating_temperature: "{{ state_attr(heating_target, 'temperature') }}"
trigger:
platform: state
entity_id: !input window_entity
from: "off"
to: "on"
action:
- service: climate.set_hvac_mode
entity_id: !input heating_target
data:
hvac_mode: "off"
- wait_for_trigger:
platform: state
entity_id: !input window_entity
from: "on"
to: "off"
- service: climate.set_hvac_mode
entity_id: !input heating_target
data:
hvac_mode: "heat"
- service: climate.set_temperature
entity_id: !input heating_target
data:
temperature: "{{heating_temperature}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment