Trigger automation timedelta trigger

Why does this not work?

---
# This blueprint takes a date and ...

blueprint:
  source_url: https://github.com/niro1987/homeassistant-config/blob/e3f45300586208045a9a79e09acef6dca277fbef/blueprints/automation/niro1987/timedelta.yaml

  name: Timedelta

  description: >-
    Some description

  domain: automation

  input:
    dt:
      name: Date/Time Sensor
      description: The datetime sensor
      selector:
        entity:
          domain: sensor
          device_class: timestamp
    hours:
      name: Hours
      description: The number of hours to use for the timedelta
      selector:
        number:
          mode: box
          min: 0
          max: 24
          step: 1
      default: 0
    minutes:
      name: Minutes
      description: The number of minutes to use for the timedelta
      selector:
        number:
          mode: box
          min: 0
          max: 60
          step: 1
      default: 0
    seconds:
      name: Seconds
      description: The number of seconds to use for the timedelta
      selector:
        number:
          mode: box
          min: 0
          max: 60
          step: 1
      default: 0
    action:
      name: Action
      description: Action to perform
      selector:
        action:
      default: []

mode: single
max_exceeded: silent

variables:
  var_dt: !input dt
  var_hours: !input hours
  var_minutes: !input minutes
  var_seconds: !input seconds
  var_target: "{{ states(var_dt) | as_datetime }}"
  var_delta: "{{ timedelta(hours=var_hours, minutes=var_minutes, seconds=var_seconds) }}"

trigger:
  - platform: template
    value_template: "{{ (now() - var_delta) > var_target }}"

action: !input action

It’s possible that a script variable doesn’t preserve the type of a timedelta object. Eliminate var_delta and put its template directly into the Template Trigger’s value_template.

tried that, but thanks for the suggestion

Oké, I found a workable solution, by moving the template to the conditions, but it’s causing the automation to trigger every time the datetime sensor is updated.

I ended up creating a binary_sensor and used the state of that in my blueprint.