Skip to content

Instantly share code, notes, and snippets.

@nikolavp
Last active February 26, 2026 16:57
Show Gist options
  • Select an option

  • Save nikolavp/bca1ce574c5e73dea7e08b0782c05699 to your computer and use it in GitHub Desktop.

Select an option

Save nikolavp/bca1ce574c5e73dea7e08b0782c05699 to your computer and use it in GitHub Desktop.
blueprint:
name: Reset climate to manual when door is closed
description: >
When a door/window sensor is closed, set a climate device back to
manual mode. Intended as the companion to the "eco on door open" blueprint.
domain: automation
input:
door_sensor:
name: Door/Window Sensor
description: The binary sensor that detects if the door is open.
selector:
entity:
domain: binary_sensor
device_class: door
climate_entity:
name: Climate Device
description: The climate device to reset to manual mode.
selector:
entity:
domain: climate
triggers:
- trigger: state
entity_id: !input door_sensor
to: "off"
conditions: []
actions:
- action: climate.set_preset_mode
target:
entity_id: !input climate_entity
data:
preset_mode: manual
mode: single
blueprint:
name: "TRV External Temperature Delta Sync"
description: >
Syncs an external temperature sensor with a TRV that has a "temperature delta" entity.
Calculates the difference between the external sensor and the TRV's internal reading,
then writes it to the TRV's delta entity. Only updates when the change exceeds a
configurable threshold to preserve battery life.
domain: automation
input:
external_sensor:
name: External Temperature Sensor
description: The external room temperature sensor entity.
selector:
entity:
domain: sensor
device_class: temperature
trv_climate:
name: TRV Climate Entity
description: The climate entity of the TRV (used to read its internal temperature).
selector:
entity:
domain: climate
trv_delta:
name: TRV Temperature Delta Entity
description: The TRV's "set temperature delta" entity.
selector:
entity:
domain: number
update_threshold:
name: Update Threshold
description: >
Minimum change in delta (°C) before updating the TRV.
Helps reduce unnecessary writes and preserve battery.
default: 0.5
selector:
number:
min: 0.1
max: 2.0
step: 0.1
unit_of_measurement: "°C"
trigger:
- platform: state
entity_id: !input external_sensor
- platform: state
entity_id: !input trv_climate
attribute: current_temperature
action:
- variables:
external_sensor: !input external_sensor
trv_climate: !input trv_climate
trv_delta: !input trv_delta
threshold: !input update_threshold
external_temp: "{{ states(external_sensor) | float(0) }}"
trv_temp: "{{ state_attr(trv_climate, 'current_temperature') | float(0) }}"
current_delta: "{{ states(trv_delta) | float(0) }}"
new_delta: "{{ (external_temp - (trv_temp - current_delta)) | round(1) }}"
- condition: template
value_template: >-
{{ (new_delta - current_delta) | abs > threshold | float(0.5) }}
- service: number.set_value
target:
entity_id: !input trv_delta
data:
value: "{{ new_delta }}"
mode: single
blueprint:
name: Set climate to eco when door is left open
description: >
When a door/window sensor stays open for a specified duration,
set a climate device to eco mode. Useful for saving energy when
someone leaves a door open.
domain: automation
input:
door_sensor:
name: Door/Window Sensor
description: The binary sensor that detects if the door is open.
selector:
entity:
domain: binary_sensor
device_class: door
climate_entity:
name: Climate Device
description: The climate device to set to eco mode.
selector:
entity:
domain: climate
open_duration:
name: Open Duration
description: How long the door must be open before triggering.
default:
minutes: 1
selector:
duration:
preset_mode:
name: Preset Mode
description: The preset mode to set when triggered.
default: eco
selector:
text:
triggers:
- trigger: state
entity_id: !input door_sensor
to: "on"
for: !input open_duration
conditions: []
actions:
- action: climate.set_preset_mode
target:
entity_id: !input climate_entity
data:
preset_mode: !input preset_mode
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment