Cronplus day/month specification

I have used the following specification: 0 45 23 * DEC,JAN *. The timer will fire every day at 2345 for December & January.
I wanted to add specific days to December & January.
For this specification: 0 45 23 6-31 DEC,JAN *; the timer will fire between 6-31 DEC & JAN at 2345.

What I want is a timer that will fire at 2345 for 6-31 DEC & 1-6 JAN.
I tried 0 45 23 6-31 DEC, 1-6 JAN * but that is invalid.
Do I need two timers?
Timer1 0 45 23 6-31 DEC *
Timer2 0 45 23 1-6 JAN *

Is there a reason two timers won't work? You can put two schedules in cronplus

Absolutely not, I already have multiple timers (schedules). But it would he more convenient with a single timer for this application. Are you suggesting that there is no way to create a single timer with the specification I require?
It could work if cronplus had an "OR" separator whereby the specification would read Timer1 OR Timer2 (as I defined Timers 1 & 2).

With one expression, you'd always skip days 1-5. So you need to use two separate expressions, like you already posted initially.

But this can be solved with cron-plus as-is.

To treat both triggered events the same, you can set the same topic or payload on each task, whatever works best for you. Add a switch node that checks for that, and you're done. :wink:

1 Like

Thanks kuema, cronplus options can be rather complex; I just wanted to make sure I wasn't missing something that would allow a single schedule to do the job. While I've used switch-nodes, I have a function-node with switch-statements. I was using the simple cronplus schedule 0 45 23 * DEC,JAN * and using a function-node to block 1-5 Dec and 7-31 Jan; it does the job, but it would be cleaner if it were done in cronplus.

It's too bad that cronplus doesn't have a "OR" separator for it's specification then, as I mentioned, the single schedule:
0 45 23 6-31 DEC * OR 0 45 23 1-6 JAN * would work.

Per se, that's not a restriction of cron-plus, it's simply not expressible via one cron statement.

I use cron-plus a lot (mostly the dynamic schedule feature), and had the same requirement of triggering one task (flow) by multiple schedules. The combination of payload and topic to logically group them together has served me well, while keeping the expressions readable and manageable.

I didn't mean to imply it was a restriction of cronplus; the "OR" separator would just be an additional feature that could be added.

While I probably setup cronplus with two schedules, I will still use the function-node date-filter because I trigger another action based on sunset, but I only want it to trigger on certain dates. Is there a way to restrict cronplus sunset triggers to specific dates?

None that I know of, it's either plain cron or "sun events".

I'm also using the chronos nodes. Besides cron and solar stuff, they offer some special nodes for time-based filters, switches, etc. Maybe you find them useful as well.

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