Is there a scheduling node that does this

[edited to clarify some points]

This is kind of a question AND an idea for a contrib (if it doesn't exist). There are a tonne of scheduling nodes and I've tried quite a few of them. Here's a good list. Perhaps I've missed this as I haven't tried them all, in which case would love to know.

Here's what I am looking for:

  • Imagine the Inject node, which has an ADD button at the bottom:

  • ... except each line you add is an event. You could then edit the details of that event. Within the details to edit, you could set name (to easily identify it from the list), and any number of message properties (again using a little ADD button, which creates multiple lines). The latter would be the same as the inject node, which allows you to e.g. set msg.topic, msg.payload, and if you like, msg.blah

  • Final two things: you could set the event start time, and a recurrence pattern like this:

  • Optionally it might allow setting a duration or end time, with different selection of message properties, the latter would be fired at the end time

  • A bonus would be the ability to set dynamic start times, e.g. sunrise, sunrise plus offset in seconds/minutes/hours, and even have these form the recurrence patterns, i.e. every day at sunrise.

I know what I'm asking for is simple, everyone does it, and there are tonnes of contribs that can do this functionality. But I simply haven't been able to find the ability to set multiple "timers" or events per single inject node, without a whole load of additional bells and whistles that confuse me a lot.

Here are some examples of what I have tried, but they don't work for me:

node-red-contrib-light-scheduler:

  • assumes I want to set an OFF payload
  • requires an end time
  • recurrence is only weekly and the visual thing is annoying
  • inflexible message properties: only allows setting topic and payload, and topic has to be same for ON and OFF

Inject Node set to "interval between times"

  • This actually comes really close but...
  • Only allows every x minutes, and not seconds / hours / days
  • Doesn't allows multiple events per node (although that's not a huge deal, you could just add multiple nodes)
  • No option for an OFF message or some more advanced stuff like sunset

Scargill's Big Timer

  • I've no doubt this is the ultimate timer, but it doesn't have the simplicity. Maybe I just need to try harder to understand it. But I have stared at it for ages trying to work out how to send a simple message with configurable properties.
  • No different message topics for different timers, or for ON vs OFF
  • IT says "MQTT payload" but I don't want to use MQTT...

Can anyone help me find something similar to what I need?

Node-red-contrib-cron-plus does pretty much all of this.

2 Likes

Great node but I fail to see how I could construct an entire message as it only allows one "Output property". The OP wants

Have you used it?

You can have 1 or hundreds of, schedules, each with own topic and unique payload, from one output pin or many. It is 100% dynamically programmable, has solar schedules with offset and pretty much everything the OP asked for.

Fan out mode permits many outputs. Did you read the readme?

Ps, it also has built in demos and a Cron builder for anyone not familiar with the powerful syntax of Cron.

Yes.

Yes.

I can see that a msg.payload can be quite extensive but how do I assign a msg.topic in addition to the msg.payload?

The 2nd field is the topic. The 1st field is the name of the schedule. It's described in the built in help.

1 Like

It couldn't be easier...

Cron+ IMO is the better choice.

Hmm it could be a teeny bit easier if the two fields you have filled with "name" and "topic" were not both initialised to "schedule1"
Or, to be fair, if I'd noticed the tooltips or RTFM. :upside_down_face:

1 Like

Look at the image I posted, in the second row I typed name, topic, payload...

Yes, I saw that thanks @Paul-Reed.
I just wanted to suggest that initial values "name1" and "topic1" would be clearer.

Until now I had not realised the topic field was there, now I can go and remove the change nodes I used to st msg.topic.

1 Like

Yes, I also agree, maybe it's something that @Steve-Mcl could consider?
(I guess we are drifting off-topic, sorry @hazymat)

1 Like

Jeeez how many clues do you want :joy::joy::joy:

Okay cronplus is really cool, really like the cronplus object it adds into the msg.

If I need msg.foo = bar, I can set msg.payload to a JSON message {"foo": "bar"}, then just use a change / function node to basically overwrite the msg object with whatever comes in from msg.payload.

Also the expression builder is very cool.

I would also add that the pre-filled text "schedule1" and "schedule1" completely confused me at first and I would have uninstalled it thinking "I have no idea what that is". Yes, I can RTFM - but after having RTFM multiple times for multiple different contribs - some of which are really badly written and take ages to get your head around, I sometimes get lazy and thing "if it isn't obvious from the UI then I don't want to invest the time". I know it's lazy but hopefully have justified why people get lazy sometimes. I usually gravitate to things that explain themselves, then dig deeper into manuals if I need to later...

2 Likes

Including flow/global?

I believe you can set msg.payload to flow.whatever or global.whatever

But I'm talking about being able to set msg.anything to xyz. Like the Inject node allows.

I do understand that train of thought however it is an absolute art to achieve. I try my best.

I certainly can change the default topic to topicx for next revision.

2 Likes

You can do that too. The payload (or whatever you want to call it) can be set to whatever. What you can't do is set multiple properties of msg (but you can set multiple properties of msg.xxx)

Not sure I understand this distinction -

Do you mean I would do it like the below?

What you have is perfectly fine. Setting multiple properties of msg.payload.

1 Like

This :point_up_2: is why it completely escaped me.

That likely would have avoided my confusion and it will be much appreciated. Cronplus is the best scheduler I tried and that's why I've stuck with it. Now that this topic has shown me "the rest of the story" it's even better and I can clean up some of the kludges I've done.

Thanks all!

1 Like