Automation trigger input_datetime instead of "for"

Hi guys,

I’m experimenting with an entity trigger using input_datetime instead of “for” (aka light on for 30sec) as described a bit above here but I couldn’t able to find a concrete example. Does anyone has something?

description: |
  Use an input datetime to replace the for value in a State trigger.
variables:
  for:
    hours: 10
    minutes: 0
triggers:
  - trigger: time
    at: input_datetime.example
  - id: set
    trigger: state
    entity_id: binary_sensor.example
    to: 'on'
    from: 'off'
  - id: reset
    trigger: state
    entity_id: binary_sensor.example
    to: 'off'
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: reset
        sequence:
          - action: input_datetime.set_datetime
            target:
              entity_id: input_datetime.example
            data:
              timestamp: 0
      - conditions:
          - condition: trigger
            id: set
        sequence:
          - action: input_datetime.set_datetime
            target:
              entity_id: input_datetime.example
            data:
              datetime: "{{ (now() + timedelta(hours= for.hours, minutes=for.minutes)).strftime('%Y-%m-%d %H:%M:%S') }}"
    default:
      #This is where your desired actions go