Why can't I increase the duration of a running timer?

I have a timer. I start it (timer.start) with an initial duration of ‘00:40:00’. That works fine.

If I then try to perform the action timer.change on the timer passing a duration value (which according to the documentation is the number of seconds to be added or subtracted from the current timer value) of 2400 (00:40:00 as seconds) it does not work and the script reports an error that the timer cannot be changed ‘beyond its duration’.

Anyone got any ideas why this is and how to overcome this error?

1 Like

You can get the same effect by calling timer.start and using a template to calculate the new duration based on the time left on the timer and the time you want to add:

action: timer.start
target:
  entity_id: timer.some_timer
data:
  duration: |
    {{ (state_attr('timer.some_timer', 'finishes_at') | as_datetime
        - now() + timedelta(seconds=40)).total_seconds() | round(0) }}