# UPDATE: V1.2.1 node-red-contrib-cron-plus scheduler (incl solar events and Timezone support)

**URL:** https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686
**Category:** Share Your Nodes
**Created:** [25 July 2019 11:54 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686 "2019-07-25T11:54:30Z")
**Posts on this page:** 20
**Page:** 6

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [31 October 2019 17:53 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/103 "2019-10-31T17:53:16Z")

</div>

> [@Steve-Mcl](#):
>
> timestamp

`cronplus.triggerTimestamp` actually. I've set it up with a switch directly behind the output of the cron node, to check if it is a command output or an event it has to output.

 ![09](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e191f3ac094a23d716de9af1e0721d7e648edb5b.png)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 October 2019 19:59 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/104 "2019-10-31T19:59:04Z")

</div>

> [@Steve-Mcl](#):
>
> Thoughts?

Seems sensible for the configuration input.

You also need a schema to support that via msg input too I think.

Also, it is really important to be able to set an offset, plus or minus. Since it is rare that you actually want something to trigger actually at sunset/rise.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 October 2019 20:03 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/105 "2019-10-31T20:03:46Z")

</div>

> [@Steve-Mcl](#):
>
> I think a second output can be added (dynamically / as an option) right? (I.e. maintain compatibility with existing flows but permit new flows to chose to send status results out of 2nd output)

Don't know that would matter since you are adding something rather than making other changes. Why not just add the 2nd output anyway? Just keep everything else the same.

> [@Sineos](#):
>
> The above expression

That does seem vastly over-complex to me. CRON syntax is complex enough already and there are other ways to easily achieve that via a simple flow.

I'm not even sure what that expression actually means which seems like a sure-fire recipe for getting things seriously messed up 🙂

---

<div class="post-metadata">

### Author: ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)
#### Post date: [31 October 2019 21:34 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/106 "2019-10-31T21:34:24Z")

</div>

Academic, kinda yes. Today I have solved this via a function node. I just very much like your cron implementation because cron is super flexible and was wondering if it could do eval of expressions. If yes, I would have switched to cron, if no I'm perfectly fine to continue using my today's approach.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [31 October 2019 23:00 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/107 "2019-10-31T23:00:35Z")

</div>

Don't forget - ideally nodes should do their core function well - and not try to overload them (or the user) with complexity. there are other nodes that can evaluate equations and pass the result to the cron node.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [31 October 2019 23:39 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/108 "2019-10-31T23:39:19Z")

</div>

> [@TotallyInformation](#):
>
> Also, it is really important to be able to set an offset, plus or minus. Since it is rare that you actually want something to trigger actually at sunset/rise.

Good thinking batman

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [1 November 2019 00:04 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/109 "2019-11-01T00:04:09Z")

</div>

> [@bakman2](#):
>
> Just wondering if [something like this](http://shawnchin.github.io/jquery-cron/) would be an easier interface for people to use

Agree. much easier to use from a newbie perspective.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [1 November 2019 00:41 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/110 "2019-11-01T00:41:03Z")

</div>

I did look at it and had a play in a jsfiddle but my thoughts were

- it didn't support seconds or years
- It didn't do things like "last Friday off month" or "first Monday" and a few other things that might convince a user it can't be done?

I might offer it as a popup that populates the expression field. Perhaps include info that not all possibilities are covered?

I suppose I could add them features via PR or request via an issue?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [1 November 2019 01:16 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/111 "2019-11-01T01:16:17Z")

</div>

> [@TotallyInformation](#):
>
> > I think a second output can be added (dynamically / as an option) right? (I.e. maintain compatibility with existing flows but permit new flows to chose to send status results out of 2nd output)
> 
> Don't know that would matter since you are adding something rather than making other changes. Why not just add the 2nd output anyway?

I see your point however the initial point was how to distinguish status messages from Cron events (and I suspect the reverse would be desired) so I think something would be necessary.

Perhaps it is possible for a node to know if a wire is connected to the 2nd output?

That would mean I could redirect status replies to 2nd output when it is wired.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [1 November 2019 01:56 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/112 "2019-11-01T01:56:45Z")

</div>

> [@Steve-Mcl](#):
>
> Perhaps it is possible for a node to know if a wire is connected to the 2nd output?

No, I don't believe that is possible, or even desirable.

> [@Steve-Mcl](#):
>
> That would mean I could redirect status replies to 2nd output when it is wired

But as the 2nd output doesn't currently exist, you could simply always send the status outputs to it and continue to send it to output 1 but maybe add a flag in the config that turned that off? That wouldn't impact any existing flows but would still enable future flows to split the outputs.

I don't think there is any real performance impact on outputting to a node output that isn't connected?

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [1 November 2019 07:07 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/113 "2019-11-01T07:07:34Z")

</div>

Maybe you just have to think differently, you might be able to break it up into several expressions like I did to solve the sunrise/sunset example above

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [1 November 2019 07:14 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/114 "2019-11-01T07:14:16Z")

</div>

Agree, offset settings +/- (settings in minutes I think will do) is a must for sunrise/sunset schedules

Also have to allow access/setting of the other typical & relevant cron settings like day of month, month, day of week, year

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/05058309f92ab60398898e64c55a65b160e8fb8b.png)

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [1 November 2019 08:02 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/115 "2019-11-01T08:02:33Z")

</div>

Don't forget that the special character options L, W, ? etc are non-standard - so does the cron library used support them ?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [1 November 2019 08:52 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/116 "2019-11-01T08:52:35Z")

</div>

This lib doesn't support `?` unfortunately.

But it does do L e.g...  
`0 12 * * MONL` At 12:00 PM, on the last Monday of the month

And W...  
`* * 1W * *` Every minute, on the first weekday of the month

Even the # option...  
`0 0 7 * * MON#1 *` At 07:00 AM, on the first Monday of the month

> [@krambriw](#):
>
> Also have to allow access/setting of the other typical & relevant cron settings like day of month, month, day of week, year
> 
> ![image.png](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/05058309f92ab60398898e64c55a65b160e8fb8b.png)

@krambriw that screenshot above is from my nodes built in help, and as far as I can see, it covers what you're asking here. An I missing something?

> [@TotallyInformation](#):
>
> I don't think there is any real performance impact on outputting to a node output that isn't connected?

Thanks for your valuable and always welcome feedback Julian. As you know it was more about avoiding adding another option by detecting if node had a wire on the 2nd output & redirecting the status replies there. But as you have said, that's not possible.

@dceejay Dave, is giving a node the awareness that a wire is attached to an output something you guys are considering? Or is there some pitfall I'm not considering?

Thank you everyone for your valuable feedback.

---

<div class="post-metadata">

### Author: ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)
#### Post date: [1 November 2019 09:13 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/117 "2019-11-01T09:13:07Z")

</div>

For users not familiar with cron: [https://www.freeformatter.com/cron-expression-generator-quartz.html](https://www.freeformatter.com/cron-expression-generator-quartz.html)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [1 November 2019 10:25 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/118 "2019-11-01T10:25:16Z")

</div>

Just be aware that not all CRON interpreters are made equal 😒

I had problems to begin with when generating a pattern using a site like the one you listed that doesn't work with CRON+

I think it was the lack of the `?` as Steve mentioned.

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [1 November 2019 11:41 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/119 "2019-11-01T11:41:54Z")

</div>

> [@Steve-Mcl](#):
>
> @krambriw that screenshot above is from my nodes built in help, and as far as I can see, it covers what you're asking here. An I missing something?

No, fine, I just wanted to be sure that the sunrise/sunset options still allowed using them

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [1 November 2019 11:46 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/120 "2019-11-01T11:46:28Z")

</div>

A node can interrogate it’s wires array to see if it is attached. But imho it would be clearer to the user if it was either selectable or there by default.  
Maybe the old behaviour could be deprecated over time ?

( indeed that is what I did for the ui chart node to remove the second output - so any existing wires keep working but any new ones would not have the option. I think the code may still be in there)

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [6 December 2019 23:28 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/121 "2019-12-06T23:28:47Z")

</div>

Bit of an interesting situation I’m seeing here. We’ve an issue at home where on humid days where when it’s dark/heavily clouded in the morning the solar panels take the power for the entire house down. I think it’s an insulation problem somewhere, with the inverter failing due to humidity. Or something. That isn’t important here. I’m running NR on a pi 3B, raspbian stretch iirc (the one before buster). It’s directly connected through an official power supply to mains, so when the power goes down, so does the pi and NR.

The situation is as follows: while the power is off, and cron+ would normally have triggered flows/actions directly added in the node configuration, they get executed rapidly after it comes back online. Should I see this as a bug or a feature? Today I had it offline for other reasons, put it back online around 10.30 pm and all notifications that normally would go out every 2 hours came in one after another

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6d02cfb43fd0c30edaa85f0a8a75d70acddc5b72.jpeg)  
These are the 11,13,15,17,19,21 (hours) daily recurring notifications to drink water. I shut off the pi around 10.30, so it shouldn’t be like a crash recovery either. I’m just not sure what’s happening here but for me it’s just notifications. Really hope this doesn’t happen for things like feeders, blinds rapidly opening/closing after power failure, and so on.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [7 December 2019 01:48 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/122 "2019-12-07T01:48:32Z")

</div>

Hmm, maybe needs an option to switch between replay after fail or delete after fail?

BTW, do yourself a favour and invest in a PC UPS. Then attach your Pi, router, AP and switch to it.

[Previous page](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686.md?page=5)

[Next page](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686.md?page=7)
