Blueprint+Automation with template trigger and trigger_variables does not trigger

Hello, I’m trying to create a blueprint with trigger_variables and a template trigger. However, the trigger is never fired. I tried setting the states of the entities used in my automation, and while the developers show true/false respectively, the trigger never fires. Is this not supported?

Automation Debug

Blueprint Config

id: e09_vent_off
alias: Storage / Vent / Turn Off
description: ''
use_blueprint:
  path: _custom/vent_humidity_temperature_off.yaml
  input:
    target_entity:
      entity_id:
        - fan.storage_vent
    humidity: sensor.storage_humidity
    humidity_ref: sensor.e01_tf_humidity
    temperature: sensor.storage_temperature
    temperature_ref: sensor.e01_tf_temperature
    temperature_offest: 0.5
    humidity_offest: 1

Automation Config

trigger_variables:
  humidity: sensor.storage_humidity
  humidity_ref: sensor.e01_tf_humidity
  humidity_offest: 1
  temperature: sensor.storage_temperature
  temperature_ref: sensor.e01_tf_temperature
  temperature_offest: 0.5
mode: single
max_exceeded: silent
trigger:
  - platform: template
    value_template: >
      "{{ ((states(humidity)|float(0) < (states(humidity_ref)|float(0) +
      humidity_offest|float(0))) and
        (states(temperature)|float(0) < (states(temperature_ref)|float(0) + temperature_offest|float(0)))) }}"
action:
  - service: homeassistant.turn_off
    target:
      entity_id:
        - fan.storage_vent
id: e09_vent_off
alias: Storage / Vent / Turn Off
description: ''

Developer Tools / Template

This is the template I used in the developer tools that shows the correct true/false outcome:

{{ ((states('sensor.storage_humidity')|float(0) < (states('sensor.e01_tf_humidity')|float(0) + 1|float(0))) and
(states('sensor.storage_temperature')|float(0) < (states('sensor.e01_tf_temperature')|float(0) + 0.5|float(0)))) }}

Full YAML

Blueprint

blueprint:
  name: Humidity & Temperature Trigger Off
  description: "Turn off an Entity or multiple Entities when humidity or temperature threshold is exceeded"
  domain: automation
  input:
    target_entity:
      name: Target Entity
      description: The entity/entities to turn off.
      selector:
        target:
          entity: {}
    humidity:
      name: Humidity Sensor
      description: The humidity sensor.
      selector:
        entity:
          device_class: humidity
    humidity_ref:
      name: Humidity Sensor Reference
      description: The humidity sensor used as reference.
      selector:
        entity:
          device_class: humidity
    humidity_offest:
      name: Humidity Offset
      description: The humidity offset to turn on the vent.
      default: 0
      selector:
        number:
          min: -100
          max: 100
          step: 0.1
          unit_of_measurement: "%"
    temperature:
      name: Temperature Sensor
      description: The temperature sensor.
      selector:
        entity:
          device_class: temperature
    temperature_ref:
      name: Temperature Sensor Reference
      description: The temperature sensor used as reference.
      selector:
        entity:
          device_class: temperature
    temperature_offest:
      name: Temperature Offset
      description: The temperature offset to turn on the vent.
      default: 0
      selector:
        number:
          min: -100
          max: 100
          step: 0.1
          unit_of_measurement: "°C"

trigger_variables:
  humidity: !input humidity
  humidity_ref: !input humidity_ref
  humidity_offest: !input humidity_offest

  temperature: !input temperature
  temperature_ref: !input temperature_ref
  temperature_offest: !input temperature_offest

mode: single
max_exceeded: silent

trigger:
  - platform: template
    value_template: >
      "{{ ((states(humidity)|float(0) < (states(humidity_ref)|float(0) + humidity_offest|float(0))) and
        (states(temperature)|float(0) < (states(temperature_ref)|float(0) + temperature_offest|float(0)))) }}"

action:
  - service: homeassistant.turn_off
    target: !input target_entity

Automation

- id: "e09_vent_off"
  alias: Storage / Vent / Turn Off
  description: ""
  use_blueprint:
    path: _custom/vent_humidity_temperature_off.yaml
    input:
      target_entity:
        entity_id:
          - fan.storage_vent
      humidity: sensor.storage_humidity
      humidity_ref: sensor.e01_tf_humidity
      temperature: sensor.storage_temperature
      temperature_ref: sensor.e01_tf_temperature
      temperature_offest: 0.5
      humidity_offest: 1
1 Like

Try removing the "" from the value_template, like this:

    value_template: >-
      {{ ((states(humidity)|float(0) < (states(humidity_ref)|float(0) + humidity_offest|float(0))) and
        (states(temperature)|float(0) < (states(temperature_ref)|float(0) + temperature_offest|float(0)))) }}
2 Likes

Thanks, that worked!

2 Likes