Automation trigger for input_datetime for

My automation : if no motion, for 2 minutes, turn off lights.
I want to replace the hours,minutes… by helper “input_datetime.wachtijd” (time only)
so the “for:” part, needs to be variable, so its easier to change the time…
but… I can’t find a solution. I’ve found 'kind of this problem" solutions here, but they don’t seem to work for me… I get an error when I try to save it.
(the “choose” keyword I use in the action part is for extending the automation further in the future)

alias: Toilet Motion STOP
description: ''
  - type: no_motion
    platform: device
    device_id: 38e9d1ee8481b1c83606adb39643af63
    entity_id: binary_sensor.toiler_hue_motion_sensor_1
    domain: binary_sensor
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
condition: []
  - choose: []
      - service: light.turn_off
        data: {}
        entity_id: light.toilet_hue_lamp_1
mode: single

Easiest way is to use an input number instead of an input datetime.

  - platform: state
    entity_id: binary_sensor.toiler_hue_motion_sensor_1
    to: 'off'
      minutes: "{{ states('input_number.wachtijd') | int }}"

Where input number wachtijd has a range of 1 to 59 (can be less, must not be more).

    name: Wachtijd
    min: 1
    max: 59
    step: 1
    unit_of_measurement: 'min'

ok, I have to use a platform: state trigger…
(still a newbee)…

Not 100% sure about that. It might work for device automations. I don’t use them so don’t know. The important bit is the use of an input number instead of input datetime.

ppffff … it works !! :slight_smile: thanks!