State trigger template in for field

As title states i’m wondering if this is possible or if there is a better way to do this that i’m just not thinking about. I’ve got an input_number with a value that i’d like to be used for the for field when a switch turns off to create a delayed timer thats configurable.

  - alias: scentsy_off_with_modeling_desk
initial_state: true
trigger:
  - platform: state
    entity_id: light.model
    to: 'off'
    for:
      minutes: {{ input_number.scentsy_time }}
action:
  - service: switch.turn_off
    data:
      entity_id: switch.scentsy

the for: minutes: of course comes back as invalid. Thanks guys

You could try {{ states.input_number.scentsy_time.state }}

Short answer, you can’t do that.

You could do it with a full template sensor

initial_state: true
trigger:
  - platform: template
    value_template: '{{ ( as_timestamp(now()) - as_timestamp(states.light.model.last_changed)|float ) >= ( states('input_number.scentsy_time')|float * 60 ) }}'
action:
  - service: switch.turn_off
    data:
      entity_id: switch.scentsy

Thanks @Tinkerer i figured i was overthinking it LOL. Granted it doesn’t work, in the template editor it shows that it turns to true, but the automation doesn’t seem to be firing as after 4-5 minutes its still on