HE/RM needs a real cron scheduler

Hi,
Cron expressions are really powerful. What is available in HE to mimic that currently is not, and limited in many ways. Please add an alternative to use a cron expression.

Doing a simple thing as this "0 0 0 ? NOV 5#4 *", which would be equal to thanksgiving (the fourth Thursday in November) is doable, but requires a lot more than this simple and effective statement.

In RM I'd really like to see it implemented both for triggers and for actions.

Thanks.

2 Likes

Might want to look at events/cogs. It has this option.

1 Like

Thanks, for suggesting. Thing is, I need the trigger to be daily, and then based on conditions, set a variable to different values pending a condition like the cron... EE allows to create complex triggers, but conditions? I'll check it out again... :slight_smile:

cron is available to Apps.

// run 'mymethod' every tenth minute.
schedule('0 */10 * ? * *', mymethod)

2 Likes

Have you used Periodic trigger in RM? That generates a Cron string. But, it does not generate every possible Cron string. I will look into adding an explicit Cron string option. One caveat is that you'd have to take responsibility for the validity of the Cron string.

4 Likes

Hi, yes I did. But creating a counterpart for this one: "0 0 0 ? NOV 5#4 *", proved to be a challenge. That'd be great if possible, thanks! :slight_smile:

A great resource posted here in the forum before is this one; Free Online Cron Expression Generator and Describer - FreeFormatter.com. Using it it's very easy to get the most out of the more complex expressions

Next release:

Needless to say, this one was very easy to add. Thanks for the suggestion.

7 Likes

Am I pushing it if asking if that can be added for Actions, to be used in conditions? It would be useful for setting RM variables to different holidays in one rule, like this, but using cron expressions instead;
holidays

Yeah, that wouldn't be very easy to do. In the first case, we are actually sending a Cron string to the hub scheduler (Quartz). In the second case you'd be asking for evaluation of a Cron string, which the hub doesn't have outside of the scheduler.

Why not just use Periodics to set the variables? Every day set the variable at midnight to "No holiday", and at 1 second after midnight on the holidays, set it to that holiday.

1 Like

How would this be accomplished? Or do you mean one rule per variable and use periodics for triggering it?

One rule for every day. One rule for each holiday. All setting the same variable.

Well, that will work, no doubt. I'd rather collect all those (not that many after all) in one, but I hear the effort needed... I'm grateful for the explicit expression in the trigger, that helps a lot, thanks! :slight_smile:

Have one rule for the simple ones, like 4/1, 7/4, 10/31, 12/25, 1/1, etc. and another for Thanksgiving, etc. The first one is just a bunch if IF-THEN, ELSE-IF... and it runs every day.

1 Like

That will do it nicely. :+1:

Just curious...are you triggering holiday lighting, turning off automations meant for work days, or simply announcing "It's Valentine's Day, dammit!"? :slight_smile:

1 Like

That's the plan, yes. I have been using all sorts of virtual switches, but variables are quite a lot nicer getting the hang of it... :slight_smile:

1 Like