Populating Action Type = Delay from input_number

Hi all,

Newbie to YAML and Jinja here, and to be honest, struggling a little with templating, etc - especially within the automation option under the “configuration” menu item in HA.

I want to define an action that turns on a switch, waits for a delay that is specified from a input_number and then turns off the same switch.

I can get the Action type = Delay to work when I use a static delay by putting {{ ‘00:00:05’ }} in for a delay of 5 seconds, but as soon as I try to replace this static value with a number taken from a input_number, I get problems.

The closest I can get is this,

‘00:00:0{{states.input_number.box2.state | int }}’

where box2 contains the value 7, but this throws there error below in the Hassio log

Error rendering ‘Nightly filtering’ delay template: offset ‘00:00:07’ should be format ‘HH:MM’ or ‘HH:MM:SS’

(“Nightly filtering” is the name of my automation)

Seems like the value ‘00:00:07’ matches the right format, yet I still get the above error.

Can someone lend me a hand? I’m pretty close to solving all of the challenges I need to, but this, which seemed so simple, has taken the longest to solve of anything so far!

I’ve made a little ‘progress’ this morning…

if I use

  • delay: ‘{{“00:00:0{{states.input_number.box2.state | int }}”}}’

it seems to work for the session that I’ve typed it in, and it shows up in the actions section of the trigger as

{{“00:00:0{{states.input_number.box2.state|int}}”}}

but upon reboot, its back to the same old error of:
Error rendering ‘Nightly filtering’ delay template: offset 00:00:0{{states.input_number.box2.state | int }} should be format ‘HH:MM’ or ‘HH:MM:SS’

Nothing changes in the text of the automations script between reboots, so now I’m completely mystified…