Remove 1 Minutes From Input Number Helper

I use this format to help set up a timer, to then trigger/stop an automation.

I’m currently trying to set after 5 minutes, something happens…
However, I’m trying to make it that, one minute before, something else happens…

(i.e., after 5 minutes a light will turn off, 1 minute before, it’ll flash to warn you)

 00:{{ '%0.2d' % states('input_number.bedtime_routine_auto_turn_off_timer') |int
  }}:00

Can anyone help edit this to be able to subtract 1 minute or 60 seconds?

1 Like

just add - 1 in your template… You’ll need to wrap it in parenthesis so the % gets the whole operation.

1 Like

Sorry, I’m being dumb.

I am, but getting this error.

TypeError: %d format: a number is required, not str

yes, wrap (states… -1 ) in parenthesis

1 Like

Sorry Petro, I’m really not getting it :smiley:

-1 goes after int, int is included in the parenthesis as is -1

1 Like

Got there in the end!

 00:{{ '%0.2d' % ((states('input_number.bedtime_routine_auto_turn_off_timer') |int ) -1) }}:00