Automtion Trigger - Dynamic For

Hello, I want to create automation trigger with dynamic/variable “for” (with helper/template).

Trigger:

entity_id: binary_sensor.n_chodba_oko_schnah_pohyb_69
platform: state
to: 'off'
for: '00:01:00'

Optimally I need to replace “for: ‘00:01:00’” with something like “for: template → {{ … }}”

This will be used for lights with dynamic time to off.

Yes, you can use templates when holding state.

    - platform: state
      entity_id:
        - device_tracker.paulus
        - device_tracker.anne_therese
      to: "home"
      for:
        minutes: "{{ states('input_number.lock_min')|int }}"
        seconds: "{{ states('input_number.lock_sec')|int }}"