Trigger-interval,

Hi Spiff, updating self.run.every - to self.run.at(trigger.interval(start, interval))-type.

Do I read the manual correct that it should be possible to use the trigger.interval-builder without assigning “start” (is this the same as start=None)?

I see there is a point in distributing the start position slightly to avoid simultaneous execution of for example all hour-based call-functions? Does it make sense to insert a random-time if no start is assigned (within say some seconds to spread them out?).

My attempt to use it without “start” yields TypeError:

ERROR | TypeError: TriggerBuilder.interval() missing 1 required positional argument: 'start'

No - if you look closely you see that start accepts None but has no default assigned.
That means you always have to provide a value.

None will run as soon as possible, so if you run something every hour you already have the offset when you schedule the callback. If you specify a start time ("00:00:00") your callbacks will run in batch. You can use .jitter() to add a random jitter to every execution (see docs).
You could also track the start time seconds e.g. in a HABApp item or a another global object and increase it every time you schedule another trigger.

But you’re probably overthinking this - if you’re not doing super CPU heavy stuff just let them run every hour in batch.

Ok, I will assign start=None if i want it to run ASAP. Thanks for your quick reply!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.