Skip to content

Instantly share code, notes, and snippets.

@niklaszerozero
Last active March 28, 2025 15:54
Show Gist options
  • Save niklaszerozero/4a459e46772b5b0683b5b5bd07305085 to your computer and use it in GitHub Desktop.
Save niklaszerozero/4a459e46772b5b0683b5b5bd07305085 to your computer and use it in GitHub Desktop.
Climate window control
mode: single
max_exceeded: silent
blueprint:
name: Climate window control
description: "
Turn off a climate entity, whenever a window is open.
And prevent the climate entity from beeing turned back on, while the window ist still open.
**Version**: 0.0.4
"
source_url: https://gist.github.com/NiklasZeroZero/4a459e46772b5b0683b5b5bd07305085
domain: automation
input:
climate_entity:
name: Climate Entity
description: The climate entity that will be controled by this automation.
default: ""
selector:
entity:
filter:
- domain: climate
multiple: false
window_sensor:
name: Window Sensor
description: The window sensor that will control the climate.
default: ""
selector:
entity:
filter:
- domain: binary_sensor
multiple: false
child_lock_switch:
name: Child Lock Switch
description: A switch that will be enabled whenever the window is open.
default: ""
selector:
entity:
filter:
- domain: switch
multiple: false
triggers:
- id: climate_changed
trigger: state
entity_id:
- !input climate_entity
- id: window_changed
trigger: state
entity_id:
- !input window_sensor
actions:
- if:
- condition: or
conditions:
- condition: state
entity_id: !input window_sensor
state: "on"
- condition: state
entity_id: !input window_sensor
state: "unavailable"
- condition: state
entity_id: !input window_sensor
state: "unknown"
then:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: !input child_lock_switch
- action: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: "off"
target:
entity_id: !input climate_entity
else:
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: !input child_lock_switch
- if:
- condition: and
conditions:
- condition: trigger
id:
- window_changed
- condition: state
entity_id: !input climate_entity
state: "off"
then:
- action: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: auto
target:
entity_id: !input climate_entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment