Update ha-smart-thermostat-control.yaml
rewritten manual adjsutment functionality
This commit is contained in:
parent
eb09ef85fc
commit
5a047ab5f7
1 changed files with 43 additions and 8 deletions
|
|
@ -120,6 +120,17 @@ blueprint:
|
||||||
max: 0.0
|
max: 0.0
|
||||||
unit_of_measurement: minutes
|
unit_of_measurement: minutes
|
||||||
step: 30.0
|
step: 30.0
|
||||||
|
sync_delay:
|
||||||
|
name: Manual Sync Delay
|
||||||
|
description: 'Delay before syncing manual temperature changes to prevent cascade loops. (Default = 3s)'
|
||||||
|
default: 3
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
mode: box
|
||||||
|
min: 1.0
|
||||||
|
max: 10.0
|
||||||
|
unit_of_measurement: seconds
|
||||||
|
step: 1.0
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
|
|
@ -146,6 +157,8 @@ trigger:
|
||||||
entity_id: !input thermostat
|
entity_id: !input thermostat
|
||||||
attribute: temperature
|
attribute: temperature
|
||||||
id: manual_adjustment
|
id: manual_adjustment
|
||||||
|
for:
|
||||||
|
seconds: !input sync_delay
|
||||||
- platform: calendar
|
- platform: calendar
|
||||||
event: end
|
event: end
|
||||||
entity_id: !input away_calendar
|
entity_id: !input away_calendar
|
||||||
|
|
@ -164,6 +177,9 @@ trigger:
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
thermostat_entities: !input thermostat
|
thermostat_entities: !input thermostat
|
||||||
|
triggered_thermostat: "{{ trigger.entity_id }}"
|
||||||
|
new_temperature: "{{ trigger.to_state.attributes.temperature | float(0) }}"
|
||||||
|
old_temperature: "{{ trigger.from_state.attributes.temperature | float(0) }}"
|
||||||
|
|
||||||
condition: []
|
condition: []
|
||||||
|
|
||||||
|
|
@ -173,20 +189,39 @@ action:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id: manual_adjustment
|
id: manual_adjustment
|
||||||
# Prevent triggering on automation's own changes
|
# Only sync if the temperature actually changed
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ (new_temperature - old_temperature) | abs > 0.1 }}"
|
||||||
|
# Check that other thermostats need syncing (have different temps)
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{{ (now() - trigger.from_state.last_changed).total_seconds() > 10 }}
|
{% set other_thermostats = thermostat_entities | reject('eq', triggered_thermostat) | list %}
|
||||||
|
{% if other_thermostats | length > 0 %}
|
||||||
|
{% set needs_sync = namespace(value=false) %}
|
||||||
|
{% for thermo in other_thermostats %}
|
||||||
|
{% set thermo_temp = state_attr(thermo, 'temperature') | float(0) %}
|
||||||
|
{% if (thermo_temp - new_temperature) | abs > 0.1 %}
|
||||||
|
{% set needs_sync.value = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ needs_sync.value }}
|
||||||
|
{% else %}
|
||||||
|
false
|
||||||
|
{% endif %}
|
||||||
sequence:
|
sequence:
|
||||||
- service: climate.set_temperature
|
# Only sync to OTHER thermostats (not the one that triggered)
|
||||||
target:
|
- repeat:
|
||||||
entity_id: !input thermostat
|
for_each: "{{ thermostat_entities | reject('eq', triggered_thermostat) | list }}"
|
||||||
data:
|
sequence:
|
||||||
temperature: "{{ trigger.to_state.attributes.temperature }}"
|
- service: climate.set_temperature
|
||||||
|
target:
|
||||||
|
entity_id: "{{ repeat.item }}"
|
||||||
|
data:
|
||||||
|
temperature: "{{ new_temperature }}"
|
||||||
- service: logbook.log
|
- service: logbook.log
|
||||||
data:
|
data:
|
||||||
name: Smart Thermostat
|
name: Smart Thermostat
|
||||||
message: 'Manual Adjustment: All thermostats synced to {{ trigger.to_state.attributes.temperature }}°'
|
message: 'Manual Adjustment: {{ triggered_thermostat }} changed to {{ new_temperature }}°, syncing to other thermostats'
|
||||||
|
|
||||||
# Priority 1: Windows/Doors Open - Turn OFF heating
|
# Priority 1: Windows/Doors Open - Turn OFF heating
|
||||||
- conditions:
|
- conditions:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue