Simple blueprint does not work (variable vs trigger_variable)

blueprint:
  name: Test Blueprint
  domain: automation
  input:
    sensor:
      name: Sensor
      selector:
        entity:
          domain:
          - input_number
          multiple: false
variables:
  sensor: !input sensor
trigger:
- platform: template
  value_template: "{{ (states(sensor) | float >= 800) }}"
action:
- service: homeassistant.toggle
  target:
    entity_id: light.test
alias: Test Automation
description: ""
use_blueprint:
  path: ABOVE BLUEPRINT PATH
  input:
    sensor: input_number.test

Hello, I have created a blueprint and an automation as shown above.
I want to adjust the input_number.test so that the automation is triggered when it is above 800, but the trigger does not work.

I think the problem is using the sensor variable in the value_template.
It works well when I change the sensor to ‘input_number.test’.

What is the problem?

variables: are not created until after the trigger occurs within the automation.
Therefore you need to use trigger_variables: for any variable you put in a trigger.

trigger_variables: are rendered when you save the automation and are available to use when a trigger occurs.

This is also why trigger_variables: are ‘limited’, because they don’t have access to anything that occurs after the automation starts.

Automation Trigger - Home Assistant.

1 Like