I have a use case where I need to created an arbitrary amount of timers ranging between 40 seconds and 3 hours. They may run in parallel which is the reason why I chose to use a local calendar to begin with.
I’ve gathered that calendars are polled every 15 minutes, which makes support for timers below 15 minutes an issue.
Is there a way around this?
Would it be possible to make HA reload all events?
Or would it be possible to override the 15 min poll time and set it for every minute at runtime - especially if timers below 15 minutes are requested?
A bit of background: I recognize that 40 seconds might be pushing it a bit in a calendar context and for that specific one I wouldn’t mind working with a datetime helper. But for the rest I’d really like to keep everything handled within the same framework.
You can use the action homeassistant.reload_config_entry to reload the integration after adding the calendar event. This method probably isn’t feasible if you plan on calling it a lot… I don’t think events will be posted while the calendar is reloading, so it’s likely that the automations wouldn’t be reliable.
In my experience 2 minutes is the smallest reliable time span… 1.5 minutes sometimes works, but not reliably.
I do agree on the reliable time span! When I tested Automations triggered by the calendar’s binary state, there was a 20-30 seconds delay reporting the calendar’s state after the calendar event ended.
Overlapping events needed to be at least minute apart to trigger an Automation.
I was thinking To-do list integration may work, but more information is needed.
They say a picture says more than a 1000 words, so here you go
This is a first version of my tactile baking timer buttons. I can tap, double tap and long press the most used timers in my baking. I debounce this input with 4-5 second delay, so while the top row buttons are “presets”, all buttons can be pressed in succession to create more arbitrary timers. The timers can run in parallel when I have many orders. Lights flash, I get a notification on my phone and a message is written on our LED panel when event ends. I plan to add sound too.
The timers above 15 minutes work as expected. So far there’s never been a need to run the 40 sec timer in parallel, so I handle that separately with input datetime. It’s working, but with my question above I’m wondering if I can stream line it more.
The to-do list could be a way to go, too, I guess, as I really only use the calendar event ended trigger. Can they be used as triggers as well when they pass deadline? What’s the polling frequency on list items?
ToDo is the definitely more dynamic than calendar events. I would consider @Didgeridrew a great resource for the ToDo List based off the solutions he has provide on this forum.
My first thought is to use the button actions to activate an Automation that:
Start the timer
update the Todo List for the specific activated timer( templating the due_datetime: + the timer length)
Wait for the timer to complete (longer timer may require a different approach)
I tested with multiple timers running simultaneously, but I am definitely open to understand a better resolution. Each timer had it’s own automation defined during testing.
Well ok.
Let’s say you want to create automation based on the buttons he has in the images above and he starts one timer with bagels and then a 1 minute timer and then a 40 minutes timer.
How do you make sure it turns on the correct timers?
The only real way is to create one timer for each length of timer. Which is very very cumbersome.
??
It does not make sense that I need to wait 15 minutes for an update when the calendar is local in HA.
How does that not make sense?
Each timer is activated by tap, double tap or long press so that could activate each of the 10 possible timers. Not ideal, but the OP simply wants a way to see what’s queued.
Yeah… it’s a bit damned if you do or don’t here, neither is perfect
With calendar I get in principle completely dynamic functionality, which is great. I am free to create X “timers”, but with the issue that short term tasks don’t work. I tested a 10 min calendar event and reloaded config after a delay, still didn’t work.
The way I understand the Todo list approach, it uses a list as reference, but is still dependent on one or more timers underneath it all to trigger things at the right time.
While the short lived timers of the same type are unlikely to run in parallel, I still would need, say, 40 sec timer (Bagels) while I give the sourdough loaf an extra 10 min in the oven.
I checked if it’s in any way possible to create timer helpers on the fly, and maybe use a todo list or a simple list to add / remove items and keep track. It doesn’t seem that’s the case. It would probably be the easiest way to create and clean up timers dynamically.
A thought experiment: Another alternative would be to create a pool of timers sharing a label or some such. I have a pretty good idea about how many of these would run at a time. When I need a timer, I could possibly seek out one that is not active (=set in the future) and then start it. Again maybe with some dynamic list that would correlate timer id with human readable task name.
But I’m not even sure it’s possible to query like that at runtime and does seem like a lot of work for such simple functionality
I was curious if it was possible to template the timer creation process to include specific identifiers, but didn’t get that far. I’ll kindly bow out and leave it up to the experts.
You could create an input text with delimiters of the times if you don’t need more than a few at the same time.
Save Unix timestamps when they should be “ringing”
Putting them in a text helper can make sense from a data persistence perspective, but how would it be template triggered? Continuous evaluation and match on “DateTime.Now”?
Yes I would think something like split on ; for example and is now timestamp more than one of the looped timestamps in this text helper then ring the alarm and delete this from the helper.
This is not something I have tried and I have no proof it works.
I think it could fail on that now only updates ones a minute if I’m not mistaken.
If I had the need, then I would try it for myself.
I know I was down the same rabbit hole as you before and I believe I even created or backed a feature request to update local calendar more often
But all this is theory. It might not work at all.
You could give it all a try Christer.
If it sounds hard and out of reach then just say so and some of us will try and set you up with parts or all of it.