Is there a way to do this with time_pattern or should I just use a timer?
I want to trigger sprinklers every hour and a half from dawn until dusk so I’m leaning towards a timer that starts at dawn and each time it fires retrigger it again unless it is after dusk, but I’m not sure if there is a simpler way.
There are not that many “hour and a half” between dawn and dusk, so maybe just list all the times in the trigger and add dusk and drawn as condition checks?
Giving this further thought, I am not sure when the first match will be for minutes: /90. Probably it will run when the automation is turned on (eg when HA is started, or someone turns the automation on), and then every 90 minutes. This means that the triggering won’t necessarily be "at dawn ten every 90 mins). There could be up to 89 minutes after dawn for the first watering.
If I am right and that the trigger will be when the automation is turned, you could turn it off then on at dawn. That’s easy.
So I would try the new ‘while’ loop that tests a state and repeats if true. Combine that with a sunrise trigger and a 90 min delay on the loop and I think you are done.
now this automation will be on all day, and maybe that could be problematic. Something throws it off, a reboot or something.
It’s more complicated but you could also do it with a automation that fires a script for the watering. You create a sensor that tracks how long it’s been since the script was fired. That automation is triggered by sunrise or passing above 90 mins since last fire. This option is better because even if HA lost track, it would start counting the 90 mins from scratch and would continue to water through the day.
That will not work. The /90 here applies only to the minutes part of any time of day, going from 0 to 59. So this will match every hour on the hour.
I proposed PR #38282 which will make the above configuration invalid. Things can still get confusing though as e.g. minutes: /25 will match xx:00, xx:25 and xx:50 … so it waits for 25 minutes two times and then for 10 minutes.
(I don’t know of a simple way to fire every 90 minutes.)
Can you please try this? You need to setup an automation which has trigger type Template. Please adjust timeout_in_minutes variable and let me know.
Information: this will check when specific automation had run last time and if X minutes had passed. If the automation has never run yet, it will take last updated time instead of last triggered. So, it is not going to be in 3:00 - 4:30 - 6:00, it will try to execute in every 90 minutes from a starting point.
PS: if you are looking for guaranteed solution, this cannot be the one please discard this possible solution, other way around, this is best intention and good will. Feel free to discard or give it a try!
You have posted a link to the Time Pattern Trigger. Did you see amelchio’s post (above) explaining why a Time Pattern Trigger cannot be used for a 90-minute interval?
This is a community platform, not a customer service, we are doing our best to help. So, I am sharing my personal experience and my thought, so, if it works perfect, if not, i will learn something new. I do not have any obligation to be sure 100% correct/valid/tested other than good intentions. If you are looking for answers which are tested/validated, I will not be able to share them and you are free to discard my messages.
Your reply only needed to be “No, didn’t test it.” However, that was evident from the fact you proposed using the Time Pattern Trigger when amelchio, one of Home Assistant’s developers, already explained it couldn’t be used to repeat every 90 minutes. Yet you proposed it anyway (10 months later).
Nowhere in the documentation does it suggest the options are additive.