Simple template trigger

I must be missing something very obvious but I cannot get the following template trigger to work.

  • trigger: template
    value_template: “{{ states(‘sensor.lightsensor_illuminance’) | float(121) < lighting_threshold }}”

If I replace the input “lighting_threshold” with a number in the value_template it works:

  • trigger: template
    value_template: “{{ states(‘sensor.lightsensor_illuminance’) | float(121) < 50 }}”

The input number is there in the Blueprint Config under a trace.

For input in the template I have:
input:
lighting_threshold:
name: Lighting Threshold
description: How dark to turn on?
default: 60
selector:
number:
min: 10.0
max: 120.0
unit_of_measurement: lux
mode: slider
step: 10.0

and in variables:

variables:
lighting_threshold: !input lighting_threshold

Any ideas what I am doing wrong?

Hello Tom,

Thanks for coming here and asking a question.
Would you be so kind as to adjusting the format of your code so that we can read it properly & check the YAML spacing, etc. Editing your original is the preferred way. It is very hard for us to tell what is what when the text formatter jumbles everything like that.
You can use the </> button like this… How to format your code in forum posts
OR… Here is an example of how to fix formatting from the site FAQ Page.
How to help us help you - or How to ask a good question.

Also please post the entire yaml. It is unclear now if this is an automation blueprint or a trigger based template sensor, and where you defined the variables.

In case it’s an automation blueprint, you’ll need to create a trigger variable using the input

trigger_variables:
  lighting_threshold: !input lighting_threshold