Hi everyone-
Thanks for taking a minute to read my post. I’m setting up my house fan in HA and ran into a weird limitation and wondering if it’s me, or intended this way. And perhaps a simple work-around.
Here’s the goal:
Starting the house fan automatically starts a 1-hour timer, then turns off when the timer expires. This part is easy enough. There are times though that I want to run the fan longer than an hour, which I thought I could use the Timer.Change service to increase the time by 30 minutes. Using a few taps of a dashboard button, I could then extend the timer to whatever duration I want.
And that’s where I’m stuck. It seems that the Timer.Change service will only add time if the total duration doesn’t exceed the original set time (in my example, 1-hour). I could obviously set the starting timer longer, but with wife and kids, that could leave the fan running non-stop!
Happy to provide more details if needed, but don’t want to get any more wordy than I already have. Thanks!!!
I tested it by using Developer Tools > Services. I used timer.change to add 10 minutes to an active 4-minute timer. A message popped up briefly (and it was also recorded in the Log) indicating it cannot extend the duration beyond the timer’s configured duration.
Instead of timer.change you’ll need to use timer.start and set duration to the desired new value. Add 30 minutes to the timer’s remaining time which is not the remaining attribute (which doesn’t count down while the timer is active) but the difference between finishes_at and now().
I solved the problem by creating an automation that calculates the remaining time of the timer, adds x seconds (900 in my case) and restarts the timer with the new calculated time
action:
- if:
- condition: state
entity_id: timer.countdown_caldaia
state: active
then:
- service: timer.start
data:
duration: >-
{% set tempo = state_attr('timer.countdown_caldaia',
'finishes_at')%} {{ 0 if tempo == none else (tempo | as_datetime -
now()).total_seconds() | int(0) +
states('input_number.extractionfan_runtime') | int(0) + 900 }}
target:
entity_id: timer.countdown_caldaia
else:
- service: timer.start
data:
duration: "00:15:00"
target:
entity_id: timer.countdown_caldaia
Thanks guys. I haven’t made the changes yet, but planned on something similar. I’m okay with a work-around, just seemed silly to arbitrarily block increases to the timer length and thought posting my situation might get some extra eye’s on it.
Genius, thanks a lot for the inspiration. It enables me to define a cap and nicely get there in incremental steps.
I have added this as an automation to a tap event on a dashboard and the entity shows the new timer value immediately. Me like a lot.