Update ha-smart-thermostat-control.yaml

external timer helper introduced
This commit is contained in:
Andreas Gammelgaard Damsbo 2025-12-05 11:27:53 +01:00
parent 182e93b5a4
commit 72a5571e4b

View file

@ -1,7 +1,12 @@
blueprint: blueprint:
name: "Smart Thermostat Controller" name: "Smart Thermostat Controller"
author: Andreas Gammelgaard Damsbo author: Andreas Gammelgaard Damsbo
description: "Advanced thermostat automation with window/door sensors, presence detection, time schedules, and holiday calendar integration" description: |
Advanced thermostat automation with window/door sensors, presence detection, time schedules, and holiday calendar integration.
SETUP REQUIRED:
1. Create an input_boolean helper (Settings > Devices & Services > Helpers > Toggle) for manual override tracking
2. Create a timer helper (Settings > Devices & Services > Helpers > Timer) for override duration
domain: automation domain: automation
source_url: https://gdamsbo.dk/forgejo/andreas/ha-smart-thermostat-control/raw/branch/main/ha-smart-thermostat-control.yaml source_url: https://gdamsbo.dk/forgejo/andreas/ha-smart-thermostat-control/raw/branch/main/ha-smart-thermostat-control.yaml
input: input:
@ -21,9 +26,17 @@ blueprint:
domain: domain:
- input_boolean - input_boolean
multiple: false multiple: false
override_timer:
name: Override Timer
description: Select a timer helper to manage override duration. Create one in Settings > Devices & Services > Helpers > Timer.
selector:
entity:
domain:
- timer
multiple: false
override_duration: override_duration:
name: Manual Override Duration name: Manual Override Duration
description: 'How long manual temperature changes should override the schedule before returning to automatic control. (Default = 120 minutes)' description: 'How long manual temperature changes should override the schedule. This sets the timer duration. (Default = 120 minutes)'
default: 120 default: 120
selector: selector:
number: number:
@ -169,6 +182,10 @@ trigger:
entity_id: !input manual_override_helper entity_id: !input manual_override_helper
to: 'off' to: 'off'
id: override_expired id: override_expired
- platform: state
entity_id: !input override_timer
to: 'idle'
id: timer_finished
- platform: calendar - platform: calendar
event: end event: end
entity_id: !input away_calendar entity_id: !input away_calendar
@ -222,8 +239,8 @@ action:
- service: logbook.log - service: logbook.log
data: data:
name: Smart Thermostat name: Smart Thermostat
message: 'Manual Override: Temperature set to {{ new_temperature }}° by {{ triggered_thermostat }}' message: 'Manual Override: {{ triggered_thermostat }} changed to {{ new_temperature }}°, syncing others'
# Sync temperature to all other thermostats FIRST # Sync temperature to all other thermostats
- repeat: - repeat:
for_each: "{{ thermostat_entities | reject('eq', triggered_thermostat) | list }}" for_each: "{{ thermostat_entities | reject('eq', triggered_thermostat) | list }}"
sequence: sequence:
@ -232,21 +249,29 @@ action:
entity_id: "{{ repeat.item }}" entity_id: "{{ repeat.item }}"
data: data:
temperature: "{{ new_temperature }}" temperature: "{{ new_temperature }}"
# Enable manual override mode AFTER syncing # Enable manual override mode
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target:
entity_id: !input manual_override_helper entity_id: !input manual_override_helper
# Simple delay timer - will complete even if automation is triggered again # Start timer
- delay: - service: timer.start
minutes: !input override_duration target:
# Disable override after timeout entity_id: !input override_timer
data:
duration: "{{ (input_override_duration * 60) | int }}"
# Priority 0b: Timer Finished - Disable override and resume schedule
- conditions:
- condition: trigger
id: timer_finished
sequence:
- service: input_boolean.turn_off - service: input_boolean.turn_off
target: target:
entity_id: !input manual_override_helper entity_id: !input manual_override_helper
- service: logbook.log - service: logbook.log
data: data:
name: Smart Thermostat name: Smart Thermostat
message: 'Manual Override: Expired after {{ input_override_duration }} minutes' message: 'Manual Override: Timer expired, resuming schedule'
# Priority 1: Windows/Doors Open - Turn OFF heating (overrides manual) # Priority 1: Windows/Doors Open - Turn OFF heating (overrides manual)
- conditions: - conditions:
@ -261,6 +286,9 @@ action:
- service: input_boolean.turn_off - service: input_boolean.turn_off
target: target:
entity_id: !input manual_override_helper entity_id: !input manual_override_helper
- service: timer.cancel
target:
entity_id: !input override_timer
- service: logbook.log - service: logbook.log
data: data:
name: Smart Thermostat name: Smart Thermostat
@ -278,6 +306,9 @@ action:
- service: input_boolean.turn_off - service: input_boolean.turn_off
target: target:
entity_id: !input manual_override_helper entity_id: !input manual_override_helper
- service: timer.cancel
target:
entity_id: !input override_timer
- service: logbook.log - service: logbook.log
data: data:
name: Smart Thermostat name: Smart Thermostat
@ -382,6 +413,5 @@ action:
name: Smart Thermostat name: Smart Thermostat
message: 'Heating OFF: No active heating conditions met' message: 'Heating OFF: No active heating conditions met'
mode: queued mode: single
max: 5
max_exceeded: silent max_exceeded: silent