Using input number in automation "for" as the minutes

Hey everyone.

I am trying to use an input number for my motion lights automation instead of saying like no motion for 10 minutes I wanna use an input number. So I can change all my automation with one variable.

I tried this, but it is not working. Anyone any idea how I could do this?
Thanks for the help!

type: no_motion
platform: device
device_id: 22abf3d61c76a649ddd9bedf5e7d5793
entity_id: binary_sensor.bed_room_motion_sensor
domain: binary_sensor
for:
  hours: 0
  minutes: | 
    {{ states('input_number.automatic_lights_off_time') }}
  seconds: 0
  milliseconds: 0

It doesn’t work because you’re using a Device Trigger and it (currently) doesn’t support templates (neither does a Device Condition or a Device Action).

Use a State Trigger.

platform: state
entity_id: binary_sensor.bed_room_motion_sensor
from: 'off'
to: 'on'
for:
  minutes: | 
    {{ states('input_number.automatic_lights_off_time') }}

Thank you! That works!

1 Like