Stop an automation after a random amount of minutes?

I have created an automation that I would like to stop after [random number] of minutes.

If I hardcode the number of minutes it works perfectly:

  trigger:
    - platform: time
      at: '18:45:00' 
      for:
        minutes: 15

I thought I could set up a random range by doing this:

  trigger:
    - platform: time
      at: '18:45:00'
      for:
        minutes: '{{ (range(10, 25) | random | int) }}' # Lights stay on between 10-25 minutes

I’m sure my syntax is wrong, but this just doesn’t work. Any thoughts on an easy way to implement this? Thanks in advance!

Try it without the quotes.

{{ (range(10, 25) | random | int) }}

If you go to the template evaluator you can see exactly what that equates to.

Actually, I was totally wrong. My “for” is not working at all. When I hard code it, it fails to load. Am I doing something wrong?

- id: vacation_office_turn_on
  alias: 'Vacation Office - Turn On'
  trigger:
    - platform: time
      at: '18:45:00'  
      for: '01:10:05'
  condition:
    - condition: state
      entity_id: input_boolean.vacation_mode_boolean
      state: 'on'
  action:
    - delay: '00:{{ (range(10, 35) | random | int) }}'  
    - service: input_boolean.turn_on
      entity_id: input_boolean.vacation_office_boolean