Ingo
December 4, 2024, 12:49am
1
I want to have a button/action that simply adds 30 minutes to a running timer.
That way I can, for instance, disable my porch camera for the time I expect not to get notifications.
But you can’t ADD time to a timer past the duration it was originally created with.
mekaneck
(Rick Auch)
December 4, 2024, 3:40am
2
I didn’t know this was a restriction until now. So I’ve voted for this. But until it gets changed, you can use the timer.start
action and a template, like this:
action: timer.start
target:
entity_id:
- timer.my_timer_entity
data:
duration: >
{% set seconds_to_add = 60 %}
{% set now_dt = now() %}
{% set finish_at = state_attr('timer.my_timer_entity', 'finishes_at') | as_datetime(now_dt) %}
{{ (finish_at - now_dt).total_seconds() + seconds_to_add }}
I would like to the this possible in more info view of a timer.
Ingo
December 6, 2024, 10:34pm
4
I spent hours trying to figure out why I couldn’t add time to a timer, then I found:
I have been using the following work around to overcome the limitation. Basically start the timer with something very big, then substrate the timer to what you need. Then you have the flexibility to add further time later.
[IMG_2744]
And how I’m working around it now:
- alias: Start or add 30 minutes to Camera-Disable Timer
if:
- condition: state
entity_id: timer.camera_disable_timer
state: active
for:
hours: 0
minutes: 0
seconds: 0
then:
- action: timer.start
metadata: {}
target:
entity_id: timer.camera_disable_timer
data:
duration: >
{{ (state_attr('timer.camera_disable_timer', 'finishes_at') |
as_datetime - now() + timedelta(minutes=30)).total_seconds() |
round(0) }}
alias: Add 30 minutes to timer
else:
- alias: Set it really high
action: timer.start
metadata: {}
data:
duration: "60:30:00"
target:
entity_id: timer.camera_disable_timer
- action: timer.change
metadata: {}
data:
duration: "-60:00:00"
target:
entity_id: timer.camera_disable_timer
alias: Reduce it by all but 30 minutes
allard77
(Allard K)
December 7, 2024, 2:22am
5
Yes, good idea. I can make a workaround automation but it would be so much better if it was a default feature of every timer!
mekaneck
(Rick Auch)
December 7, 2024, 2:27am
6
This would be simpler, like I proposed above…
- alias: Start or add 30 minutes to Camera-Disable Timer
action: timer.start
target:
entity_id: timer.camera_disable_timer
data:
duration: >
{% set minutes_to_add = 30 %}
{% set now_dt = now() %}
{% set finish_at = state_attr('timer.my_timer_entity', 'finishes_at') | as_datetime(now_dt) %}
{{ (finish_at - now_dt).total_seconds() + 60*minutes_to_add }}
1 Like
Ingo
December 7, 2024, 6:00pm
7
I’ll definitely try that next time I have a moment!