# 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:** 9

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [16 April 2020 07:40 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/163 "2020-04-16T07:40:29Z")

</div>

You can still feed a schedule into the node.

determine sunrise/sunset for today -/+ x minutes --\> cronplus schedule.

I see your point though, would be nice to apply cron scheduling on sunrise/sunset times, but might become complex.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [16 April 2020 07:44 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/164 "2020-04-16T07:44:04Z")

</div>

@Steve-Mcl - may I have one suggestion:

Currently when entering a cron expression, it starts with an error "invalid or unsupported expression", would it be nicer to show examples instead of an error ?

---

<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: [16 April 2020 07:58 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/165 "2020-04-16T07:58:12Z")

</div>

> [@krambriw](#):
>
> And would it not be possible then to add support also for an input trigger? I mean if I trigger the input with a keyword, the node would respond with either sun\_is\_down or sun\_is\_up (current state)?

Already considered this & I'm definitely adding that now (as maxims go... great minds think alike)

> [@bakman2](#):
>
> Currently when entering a cron expression, it starts with an error "invalid or unsupported expression", would it be nicer to show examples instead of an error

I've toying with adding an auto complete list of sample expressions but could never reconcile in my head how best to do this. Also been considering having a default Cron entry but couldn't bring myself to choose a default as IMO, the initial error forces the user to enter a value.  
How would you handle this?  
Opinions welcome.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [16 April 2020 08:01 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/166 "2020-04-16T08:01:26Z")

</div>

> [@bakman2](#):
>
> I see your point though, would be nice to apply cron scheduling on sunrise/sunset times, but might become complex.

I wasn't meaning that the node could provide that feature between sunset and sunrise, but that a similar effect (state initialisation on restart) can be achieved with normal cron scheduling by using the 'every 2 mins' technique, but state initialisation cannot be achieved where sunrise/sunset determine the required state.

---

<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: [16 April 2020 08:24 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/167 "2020-04-16T08:24:28Z")

</div>

> [@krambriw](#):
>
> trigger the input with a keyword

I thought cron+ already had the command : status to report the state of any of the schedules ?

---

<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: [16 April 2020 08:28 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/168 "2020-04-16T08:28:45Z")

</div>

Yes `status` & `status_all` commands but the sunrise/sunset thing is a bit different (I need to add something to its status output to fulfil some of the requirements)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [16 April 2020 10:22 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/169 "2020-04-16T10:22:17Z")

</div>

> [@Steve-Mcl](#):
>
> Yes `status` & `status_all` commands but the sunrise/sunset thing is a bit different

In fact I think maybe it is not necessary to do any more than add something to the status output for sunrise and sunset. Just providing the current condition, whether currently day or night based on the settings for the cron schedule, would be good enough, for my purposes at least. I could trigger a status on startup and use that to set my state.

---

<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: [16 April 2020 10:43 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/170 "2020-04-16T10:43:19Z")

</div>

I'd vote for that also.

---

<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: [16 April 2020 10:45 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/171 "2020-04-16T10:45:15Z")

</div>

> [@Colin](#):
>
> In fact I think maybe it is not necessary to do any more than add something to the status output for sunrise and sunset

> [@dceejay](#):
>
> I'd vote for that also.

As I started modifying the UI for adding extra options - thats exactly the conclusion I came to.

I will do some testing and examples & feedback here - see if it fits your needs.

---

<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: [16 April 2020 10:51 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/172 "2020-04-16T10:51:54Z")

</div>

> [@Steve-Mcl](#):
>
> modifying the UI for adding extra options

sorry - now confused... I think we are advocating NOT changing the ui... just adding the "daytime" true/false to the control status instead.

---

<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: [16 April 2020 11:01 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/173 "2020-04-16T11:01:30Z")

</div>

Thats how I'm handling it for first iteration Dave.

> [@Colin](#):
>
> In fact I think maybe it is not necessary to do any more than add something to the status output for sunrise and sunset

I was responding to this ^

Once I have satisfied users base requirements (ability to know if it is currently sunrise/sunset & fire an event at startup) & I have more time, I am going to re-arrange the UI (schedules list part) to make it easier to graphically add options - as it stands, its a major chore.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [16 April 2020 11:08 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/174 "2020-04-16T11:08:48Z")

</div>

While being fancy, instead of sunrise-sunset - use suncalc.js instead and expose all available properties 😬

---

<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: [16 April 2020 11:09 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/175 "2020-04-16T11:09:29Z")

</div>

there are of course multiple nodes for that already....

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [16 April 2020 11:09 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/176 "2020-04-16T11:09:51Z")

</div>

Sure, but Steve is doing the same right 😉

---

<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: [16 April 2020 11:11 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/177 "2020-04-16T11:11:05Z")

</div>

well people are trying to make him do it... not quite the same thing.

as we always said - each node should do it's job and do it well... not try to do everything...

eg [https://flows.nodered.org/node/node-red-node-suncalc](https://flows.nodered.org/node/node-red-node-suncalc) - already provides two outputs - one every minute and one on the actual transitions.

---

<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: [16 April 2020 11:15 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/178 "2020-04-16T11:15:47Z")

</div>

I mostly agree with the atomic approach but in the case of cron-plus node, the sunrise and sunset fall under the umbrella of its primary function to schedule events (dynamically) - sunset and sunrise being valid schedules.

Perhaps i should have named it scheduler-plus 😉

---

<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: [16 April 2020 11:31 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/179 "2020-04-16T11:31:37Z")

</div>

> [@dceejay](#):
>
> trying to make him do it.

convincing him to,,,rather

Many nodes may/are overlapping each other in terms of functionality, like also NR does overlap other applications trying to do similar stuff (who is overlapping and who is overlapped, well it's like the hen & the egg, who came first). I believe, at the end, nodes that best provide most useful functions in an easy to understand & configurable way will be used by most users. In balance with the visibility of the flow. I mean, I node packed with settings and features looks simple from the outside and makes the flow cleaner but may make it more difficult to understand what's going on under the hood if you are just looking at the flow in the editor

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [16 April 2020 12:58 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/180 "2020-04-16T12:58:50Z")

</div>

> sunset and sunrise being valid schedules.

So are:

sunriseEnd  
goldenHourEnd  
solarNoon  
goldenHour  
sunsetStart  
dusk  
nauticalDusk  
night  
nadir  
nightEnd  
nauticalDawn  
dawn

For me personally you can leave it all out including sunrise/sunset, because as said, there are dedicated nodes available to produce this information.

---

<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: [16 April 2020 13:14 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/181 "2020-04-16T13:14:45Z")

</div>

> [@bakman2](#):
>
> So are:
> 
> sunriseEnd  
> goldenHourEnd  
> solarNoon  
> goldenHour  
> sunsetStart  
> dusk  
> nauticalDusk  
> night  
> nadir  
> nightEnd  
> nauticalDawn  
> dawn

and...  
civil dawn  
civil dusk  
astronomical dawn  
astronomical dusk  
tea time  
bed time  
[hammer time](https://www.tomscott.com/hammer/)

the list goes on - but it doesnt make the addition of sunrise / sunset any less useful.

Additionally, many of those can be approximated as offsets of location+sunrise / location+sunset.

Lastly, sunrise / sunset is not that expensive to include (in terms of calculation time) so no great shakes.

---

<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: [16 April 2020 14:06 UTC](https://discourse.nodered.org/t/update-v1-2-1-node-red-contrib-cron-plus-scheduler-incl-solar-events-and-timezone-support/13686/182 "2020-04-16T14:06:00Z")

</div>

Updated to V0.6.5 (github only - need testers)

Key points...

- triggered schedules, "status" and "status-all" now provide additional info

- ability to perform "describe" command on a sunrise/sunset for location - meaning you can ask for sun state at any time for any location

- Demo ...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/b/2b927020390493ae4dd16a10e901ed6585c54057.png)

- status object  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/3246e93d6f2a7b44921f3dc5b58450b9627840b8.png)

This gives you the ability to trigger a "status" command on node-red start & understand if you need to take action.

Acknowledgements - yes there is a fair few properties in there - use what you need, ignore the rest. My personal take on this is - if i dont include things like the timeZone of the server or the offset applied etc, debugging is a pain AND if i DO need that info downstream, i have to jump through hoops (or should i say change nodes, flow/global context) to tack the info onto the object. Context is king.

[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=8)

[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=10)
