Help - Blueprint trigger

Hi community, please help with the trigger in this blueprint

blueprint:
  name: Update Entity Offset
  description: Update the offset attribute of an entity based on another sensor's state
  domain: automation
  input:
    sensor_to_monitor:
      name: Zigbee Sensor to Monitor
      description: The sensor whose state will be used to update the "offset" attribute
      selector:
        entity:
          domain: sensor
          device_class: temperature
    entity_to_update:
      name: Tado Entity to Update
      description: The entity whose "offset" attribute will be updated
      selector:
        entity:
            domain: climate
    threshold:
      name: Threshold
      description: The maximum difference between the two sensors to trigger the automation
      selector:
        number:
          min: 0
          max: 10
          step: 0.5
          unit_of_measurement: "°C"
variables:
  entity_to_update: !input entity_to_update
  sensor_to_monitor: !input sensor_to_monitor
trigger:
  platform: numeric_state
  entity_id:
    - !input sensor_to_monitor
    - !input entity_to_update
  value_template: "{{ (states(sensor_to_monitor)|float - state_attr(entity_to_update, 'current_temperature')|float)|abs }}"  
  above: !input 'threshold'

action:
  - service: tado.set_climate_temperature_offset
    data:
      offset: "{{( state_attr(entity_to_update, 'offset_celsius')|float if state_attr(entity_to_update, 'offset_celsius') is not none else 0 ) + ((states(sensor_to_monitor)|float - state_attr(entity_to_update,  'current_temperature')|float) if states(sensor_to_monitor) is not none and state_attr(entity_to_update, 'current_temperature') is not none else 0 ) | round(1)}}"
    target:
      entity_id: !input entity_to_update

Everything works, but the trigger is just not getting values from the two variables.
If the trigger is put into dev tools → templates with appropriate names, value is being calculated correctly.

Thanks!

Variables do not render until after the trigger, no matter where in the BP you put them. You must use trigger_variables to do what you are trying to do.

If this fixes your issue please consider clicking solution button.

Thanks @Sir_Goodenough,
although I understand the logic behind the suggestion, I don’t get how to properly change my trigger with the correct sintax. Can you give me a hand maybe?
Thanks!

I sent a link with the exact section of syntax on how to do use trigger_variables.

Would you like me to copy pieces of that and paste it here?

It’s just a matter of adding trigger_ to the word variables.

OKkay understood. Did it myself thanks for the hint.

1 Like