Skip to content

Instantly share code, notes, and snippets.

@AlexanderBabel
Last active November 2, 2024 17:02
Show Gist options
  • Save AlexanderBabel/69c3b996a66b3a132cafadcbac4140cc to your computer and use it in GitHub Desktop.
Save AlexanderBabel/69c3b996a66b3a132cafadcbac4140cc to your computer and use it in GitHub Desktop.
blueprint:
name: Smart Thermostat
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. In
order to avoid heating in summer, you can specify the weather entity and your
winter temperature. Read more: https://community.home-assistant.io/t/smart-thermostat-2-0-blueprint/478348'
domain: automation
source_url: https://gist.github.com/AlexanderBabel/69c3b996a66b3a132cafadcbac4140cc
input:
window_sensor:
name: Window / Door Sensor Group
selector:
entity:
domain: binary_sensor
multiple: false
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: 5
selector:
number:
mode: box
min: 0.0
max: 3600.0
unit_of_measurement: seconds
step: 1.0
weather:
name: Weather
description: Specify your weather to get the current outside temperature from.
selector:
entity:
domain: weather
multiple: false
wintermode:
name: Wintermode
description: The ouside temperature needs to be below this to activate wintermode.
(Default = 16°C)
default: 16
selector:
number:
step: 0.5
min: 0.0
max: 150.0
unit_of_measurement: °C or °F
mode: slider
wintermode_delay:
name: Wintermode Delay
description: Time the outside temperature neeeds to stay above the wintermode
temperature to turn the heating off.
default: 30
selector:
number:
mode: box
min: 1.0
max: 86400.0
unit_of_measurement: minutes
step: 1.0
thermostat:
name: Thermostat
selector:
entity:
domain: climate
multiple: false
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
- platform: numeric_state
entity_id: !input weather
attribute: temperature
below: !input wintermode
for: !input wintermode_delay
- platform: numeric_state
entity_id: !input weather
attribute: temperature
above: !input wintermode
for: !input wintermode_delay
action:
- choose:
- conditions:
- condition: and
conditions:
- condition: state
entity_id: !input window_sensor
state: 'off'
- condition: numeric_state
entity_id: !input weather
attribute: temperature
below: !input wintermode
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: auto
entity_id: !input thermostat
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input window_sensor
state: 'on'
- condition: numeric_state
entity_id: !input weather
attribute: temperature
above: !input wintermode
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