Trigger with duration selector doesn't work

Hi,

I have a bigger blueprint with many trigger but this specific trigger doesn’t work.
I have reduced the code to the problem.
My goal is, to trigger the automation if the specific entity with a number is above or below a value for a given duration. All these parameters should be configurable as inputs of the blueprint.

Blueprint:

blueprint:
  name: Test Trigger
  description: delete me
  domain: automation
  input:
    sun_brightness_entity:
      name: Sun Brightness Entity
      selector:
        entity:
          filter:
            - domain: input_number
    sun_brightness_min:
      name: Sun Brightness Minimum
      description: Nur wenn die Helligkeit der Sonne über diesem Wert liegt, wird beschattet.
      default: 49999
      selector:
        number:
          min: 0
          max: 200000
          unit_of_measurement: lx
    delayed_sun_brightness_to_high:
      name: Delay Sun Brightness to high
      description: Verzögerung, wenn die Helligkeitsschwelle überschritten wird.
      default:
        minutes: 2
      selector:
        duration:
    delayed_sun_brightness_to_low:
      name: Delay Sun Brightness to low
      description: Verzögerung, wenn die Helligkeitsschwelle unterschritten wird.
      default:
        minutes: 15
      selector:
        duration:

mode: queued

triggers:
  - trigger: numeric_state
    entity_id:
      - !input sun_brightness_entity
    for:
      hours: "{{ delayed_sun_brightness_to_high.hours }}"
      minutes: "{{  delayed_sun_brightness_to_high.minutes }}"
      seconds: "{{  delayed_sun_brightness_to_high.seconds }}"
    above: !input sun_brightness_min
  - trigger: numeric_state
    entity_id:
      - !input sun_brightness_entity
    for:
      hours: "{{  delayed_sun_brightness_to_low.hours }}"
      minutes: "{{  delayed_sun_brightness_to_low.minutes }}"
      seconds: "{{  delayed_sun_brightness_to_low.seconds }}"
    below: !input sun_brightness_min

actions:
  - action: notify.torsten_telegram
    metadata: {}
    data:
      message: Trigger ausgelöst

Automation to test the Blueprint:

alias: Test Trigger
description: ""
use_blueprint:
  path: own/test_trigger.yaml
  input:
    sun_brightness_entity: input_number.test_trigger
    sun_brightness_min: 11416
    delayed_sun_brightness_to_high:
      hours: 0
      minutes: 1
      seconds: 0
    delayed_sun_brightness_to_low:
      hours: 0
      minutes: 1
      seconds: 0

I changed the entity “input_number.test_trigger” to 100.000, waited 5 minutes, changed it to 0, waited 5 minutes, …
But the automation never gets triggered.

Regarding the documentation and the samples in this forum that I found, I’m not able to see the error in this code.

How can I debug a automation trigger, if it never gets fired?
Is it possible to see the “processed” code where the variables of the blueprint are replaced by the values?
Does someone see what’s wrong here?

Thanks a lot
Torsten

You cannot use inputs directly in templates, they need to be stored to script variables first.

Since you need to use these values in a trigger you will need to set them up under the key trigger_variables.

Thanks a lot!
That was the missing piece.

To get the above code working, I just had to add these lines:

trigger_variables:
  delayed_sun_brightness_to_high: !input delayed_sun_brightness_to_high
  delayed_sun_brightness_to_low: !input delayed_sun_brightness_to_low