Blueprint trigger not working

Hello,

I hope someone here can help me. I’m trying to create a blueprint, and the action works, but unfortunately the trigger doesn’t.

I suspect my variables are the problem, but no matter how I try, I can’t get it to execute automatically.

Is there a way to test a blueprint, similar to the developer tools?

Or does anyone know where my mistake is and can help me get started?

blueprint:
  name: Heizungs-Offset anpassen
  description: Passt das Offset von Heizungen anhand externer Sensoren an
  domain: automation
  input:
    heater_temp:
      name: Heizungstemperatur
      description: Die aktuelle Heizungstemperatur der gewünschten Heizung
      selector:
        entity:
          filter:
            - domain: climate
    heater_cal:
      name: Heizungskalibrierung
      description: Der aktuelle Kalibrierungswert der gewünschten Heizung
      selector:
        entity:
          filter:
            - domain: number
              device_class: temperature
    sensor_temp:
      name: Sensortemperatur
      description: Die aktuelle Sensortemperatur des gewünschten Raumes
      selector:
        entity:
          filter:
            - domain: sensor
              device_class: temperature
trigger_variables:
  heater_temp_trig: !input heater_temp
  sensor_temp_trig: !input sensor_temp
triggers:
  - trigger: template
    value_template: >-
      {{state_attr(heater_temp_trig,'current_temperature')|float
      != states(sensor_temp_trig)|float}}
conditions: []
variables:
  heater_temp_ent: !input heater_temp
  heater_cal_ent: !input heater_cal
  sensor_temp_ent: !input sensor_temp
actions:
  - target:
      entity_id: !input heater_cal
    data:
      value: >-
        {{((states(sensor_temp_ent)|float -
        state_attr(heater_temp_ent,'current_temperature'))|round(1)
        +
        states(heater_cal_ent)|round(1))|round(1)}}
    action: number.set_value
mode: single

Thanks in advance.
Nick

Your variables seem okay, it’s the trigger that is the problem. A Template trigger only fires when it’s rendered value changes from false to true. You’ve created a trigger that will almost never be false

You could use a State trigger:

...
triggers:
  - trigger: state
    entity: !input sensor_temp
    not_to:
      - unknown
      - unavailable
variables:
  heater_temp_ent: !input heater_temp
  heater_cal_ent: !input heater_cal
  heater_temp: "{{ state_attr(heater_temp_ent , 'current_temperature') | round(1) }}"
  room_temp: "{{ trigger.to_state.state | round(1) }}" 
conditions:
  - condition: template
    value_template: "{{ heater_temp != room_temp }}"    
actions:
  - target:
      entity_id: !input heater_cal
    data:
      value: >-
        {% set offset = states(heater_cal_ent) | round(1) %}
        {{ (room_temp - heater_temp + offset) | round(1) }}
    action: number.set_value
mode: single

Hello,

Thank you for your reply.

I simulate the false by manually triggering the automation and then set the external thermometer to the heater. The temperature changes, the value becomes true, but the trigger is not activated—I’ve been sitting here testing it for half the day.

Nothing helps—if only I could test the blueprint in the developer tools, that would definitely help me.




Me again,

what a bummer… after restarting not only HA but the entire device, seems it suddenly works as desired.

Maybe it’s related to an error I sometimes get - z2m, mosquitto, or whatever restarts every 2 minutes, causing all z2m devices to become temporarily unknown. I have no idea if this was due to today’s HA Core update or whatever, but I’ve had this problem again since around noon.

Since restarting the device, these errors have disappeared and the blueprint is running.

Thank you very much for pointing out the correct trigger; I would have been searching forever.

Regards,

Nick