Open ibatten opened 3 weeks ago
This automation generates no trace:
variables:
local_offset: number.sonoff_trvzb_local_temperature_offset
remote_sensor: sensor.olimex_esp32_poe_iso_0a8ac8_bedside_temperature
trv_sensor: climate.sonoff_trvzb_thermostat
threshold: '{{ states(''input_number.heating_minimum_change'') | float (0.1) }}'
alpha: >-
{{ states('input_number.heating_alpha_mix_old_value_with_new_value') |
float(0.1) }}
invalid_inputs: |
{{ is_state(remote_sensor, ['unknown', 'unavailable']) or
is_state(trv_sensor, ['unknown', 'unavailable']) or
is_state(local_offset, ['unknown', 'unavailable']) }}
old_offset: '{{ states(local_offset)|float(0) }}'
trv_raw: |
{{ state_attr (trv_sensor, 'current_temperature')|float(0) - old_offset }}
new_offset: '{{ states(remote_sensor)|float(0) - trv_raw }}'
damped_offset: |
{{ ((1-alpha) * new_offset + alpha * old_offset)|round(1) }}
offset_changed: '{{ (old_offset - damped_offset)|abs >= threshold }}'
sensible_offset: '{{ damped_offset|abs < 5 }}'
triggers:
- trigger: state
entity_id:
- sensor.olimex_esp32_poe_iso_0a8ac8_bedside_temperature
for:
seconds: 30
- trigger: state
entity_id:
- climate.sonoff_trvzb_thermostat
attribute: current_temperature
for:
seconds: 30
conditions: '{{ not invalid_inputs and offset_changed and sensible_offset }}'
actions:
- action: number.set_value
metadata: {}
data:
value: '{{ damped_offset }}'
target:
entity_id: '{{ local_offset }}'
- delay:
minutes: 1
mode: queued
id: '1728942436281'
alias: Calibrate TRV Front Bedroom
description: ''
This automation generates a trace:
variables:
local_offset: number.sonoff_trvzb_local_temperature_offset
remote_sensor: sensor.olimex_esp32_poe_iso_0a8ac8_bedside_temperature
trv_sensor: climate.sonoff_trvzb_thermostat
threshold: '{{ states(''input_number.heating_minimum_change'') | float (0.1) }}'
alpha: >-
{{ states('input_number.heating_alpha_mix_old_value_with_new_value') |
float(0.1) }}
invalid_inputs: |
{{ is_state(remote_sensor, ['unknown', 'unavailable']) or
is_state(trv_sensor, ['unknown', 'unavailable']) or
is_state(local_offset, ['unknown', 'unavailable']) }}
old_offset: '{{ states(local_offset)|float(0) }}'
trv_raw: |
{{ state_attr (trv_sensor, 'current_temperature')|float(0) - old_offset }}
new_offset: '{{ states(remote_sensor)|float(0) - trv_raw }}'
damped_offset: |
{{ ((1-alpha) * new_offset + alpha * old_offset)|round(1) }}
offset_changed: '{{ (old_offset - damped_offset)|abs >= threshold }}'
sensible_offset: '{{ damped_offset|abs < 5 }}'
triggers:
- trigger: state
entity_id:
- sensor.olimex_esp32_poe_iso_0a8ac8_bedside_temperature
for:
seconds: 30
- trigger: state
entity_id:
- climate.sonoff_trvzb_thermostat
attribute: current_temperature
for:
seconds: 30
conditions:
- condition: template
value_template: '{{ not invalid_inputs and offset_changed and sensible_offset }}'
actions:
- action: number.set_value
metadata: {}
data:
value: '{{ damped_offset }}'
target:
entity_id: '{{ local_offset }}'
- delay:
minutes: 1
mode: queued
id: '1728942436281'
alias: Calibrate TRV Front Bedroom
description: ''
I believe the "conditions" is the only difference.
The problem
I have a blueprint which generates an automation for each of my Sonoff Zigbee TRVs, which applies a local calibration offset.
It contains a "- variables" clause which calculates some values culminating in a new local calibration offset, a "- conditions" clause which uses those variables to determine the offset has changed and therefore whether the automation needs to complete, and some actions. The actions are a number.set_value on the local offset, followed by a delay of 60 seconds. The delay is there because one of the triggers is the temperature reported by TRV changing, and obviously changing the offset will change the reported temperature.
Recently, and I do not know when this started as I have not had cause to look at the traces for a months or so, the trace timeline records no information. Whether the condition is true or false, I just get "Not all shown logbook entries might be related to this automation.". The individual steps are recorded correctly, the flow graph is correct, all the information in each step is correct, all that is missing is the timeline under "Trace Timeline".
Based on comments in #93187 I removed the condition, replacing it with conditions: []. The Trace Timeline was now reported correctly (this edit is benign, as there is no harm in writing an unchanged value to the TRV).
Looking at other blueprints I have which do not show this problem, but have a similar structure (calculate some variables, use them to determine if we have work to do, do it) I noticed that this was the only one where I had used the conditions: template shorthand. Rewriting this blueprint as the full:
conditions:
Appears to restore the Trace Timeline to function. Changing another blueprint from the full form to the abbreviated "condition: {{ template }}" form appears to break it.
So I think that use of the abbreviated condition: template form breaks trace timelines.
What version of Home Assistant Core has the issue?
core-2024.10.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
core
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response