Update ha-smart-thermostat-control.yaml
adjusted triggers
This commit is contained in:
parent
66ddee0043
commit
812e5c123f
1 changed files with 12 additions and 6 deletions
|
|
@ -205,12 +205,18 @@ trigger:
|
||||||
variables:
|
variables:
|
||||||
thermostat_entities: !input thermostat
|
thermostat_entities: !input thermostat
|
||||||
triggered_thermostat: "{{ trigger.entity_id | default('none') }}"
|
triggered_thermostat: "{{ trigger.entity_id | default('none') }}"
|
||||||
# FIX: Safely retrieve state objects for non-state triggers (e.g., calendar, numeric_state)
|
# Access temperature safely:
|
||||||
safe_to_state: "{{ trigger.to_state | default({}) }}"
|
# 1. Get the 'to_state', defaulting to a simple object/dict if missing.
|
||||||
safe_from_state: "{{ trigger.from_state | default({}) }}"
|
# 2. Get the 'attributes' from that object, defaulting to a dict if missing.
|
||||||
# Use the safe state objects to get temperatures
|
# 3. Get the 'temperature' from the attributes, defaulting to 0, then convert to float.
|
||||||
new_temperature: "{{ safe_to_state.attributes.temperature | float(0) }}"
|
new_temperature: >
|
||||||
old_temperature: "{{ safe_from_state.attributes.temperature | float(0) }}"
|
{{ trigger.to_state.attributes.temperature | default(0) | float(0)
|
||||||
|
if trigger.to_state is defined and trigger.to_state.attributes is defined
|
||||||
|
else 0 }}
|
||||||
|
old_temperature: >
|
||||||
|
{{ trigger.from_state.attributes.temperature | default(0) | float(0)
|
||||||
|
if trigger.from_state is defined and trigger.from_state.attributes is defined
|
||||||
|
else 0 }}
|
||||||
override_helper: !input manual_override_helper
|
override_helper: !input manual_override_helper
|
||||||
day_temp_input: !input day_temp
|
day_temp_input: !input day_temp
|
||||||
night_temp_input: !input night_temp
|
night_temp_input: !input night_temp
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue