I want to turn on my towel dryer for a variable amount of time. Everytime I push a button, I want to extend the time running for 10 minutes.
So I press two times in a row, it should run for 20 minutes. Then, 5 minutes later I press again which adds again 10 minutes → 25 minutes in total.
My approach was to use a timer for this and everytime I press the button I add 10 minutes to the timer. Tmer.finished triggers an automation to turn off the dryer. However, this is not possible and I get below error:
Not possible to change timer timer.timer_handtuchtrockner beyond duration
Any suggestions on how to properly solve this? I’m a bit stuck…
It’s true that you can’t use timer.change to extend the timer past it’s original duration, but you can use timer.start on a running timer to get the same effect. Here’s an example script I use that adds 10 minutes to however long the timer has left.
alias: Some Timer - Add Time
sequence:
- data:
duration: |
{{ (state_attr('timer.some_timer', 'finishes_at') | as_datetime
- now() + timedelta(minutes=10)).total_seconds() | round(0) }}
target:
entity_id: timer.some_timer
action: timer.start
mode: single
So your script or automation for the button press could check if the timer is running. If not, then start it for 10 minutes. If so, then add 10 minutes as shown above.
However, I am wondering why it’s not allowed to change a timers duration above it’s initial value. Would make this thing way easier. There must be a legit reason