[ANNOUNCE] node-red-contrib-ui-time-scheduler

Ui Time Scheduler

Back in late 2018 I was looking for a simple time scheduler for the node-red dashboard that any person without any technical background (and without access to the node-red flow editor) could easily operate. I found many nodes that did a good job at the node-red flow editor, but I did not find any for the dashboard. I also did not want to use big “thrown together” flows that would require to import many different nodes every time; I needed a simple solution. Hence, I decided to build my own time-scheduler for the node-red dashboard.

What is it for?

In short: for everything that you want to control based on a specific time and day of the week. For example: Power on your heater every day from 7am to 10am. Turn on your lights FR, SA and SU from 8pm to 11pm and so forth… My personal use case was to schedule a pump for a swimming pool.

Highlights

  • easily create schedules at the node-red dashboard
  • control one or more devices with just one node
  • very simple flow structure / does not need a lot of space at the dashboard
  • two modes:
    • Default Mode : define a time frame in which your device should be switched on
    • Event Mode : define an exact time to carry out an arbitrary action
  • the node is available in English and German and easily adapted to your native language
  • stringified JSON input & output to make schedules persistent without extra steps

How does it work?

Whenever you add or delete a schedule, the node sends a JSON string to its top output. You can use such a string to directly inject timers after a (re)boot or (re)deploy. Here is an example:

The generated JSON string depends on the mode one has chosen. You can find examples at the nodes GitHub site.

Demo

Your feedback is appreciated

Recent additions allow different options and functionality. Feel free to make suggestions or report problems at the nodes GitHub site.

Thank you!

7 Likes

Thank you very much. This is also a much needed feature for the dashboard.
I will give it a try and let you know :grinning:

I tried the node and found two problems: (These are the reasons that I did not use this node in our implementation):

  1. The node keeps on sending out "true" or "false" information every minute.
    Is there a way to send out the "true" or "false" command just once?

  2. The timing of "on" and "off" is off by almost half minute with a refresh rate of 60 seconds. If we increase the refresh rate, then the message sent out will increase too, which is not desired

add an RBE node to remove the duplicates ?

  1. I built it that way so that a timer that runs from let's say 08:00 to 10:00 would also trigger the output to true even if you would turn on or restart your node-red server at, let's say, 09:30. Or even if someone would (un)intentional turn the device off even though it should be on. As @dceejay already mentioned you can remove duplicates with an RBE node.
  2. That is currently correct. If you deploy at, let's say 10:12:17 - the node will check 60 seconds after that again. I am planning on changing that behavior so that it starts at a full minute and goes on from there. Improved with v0.4.2 - timing should be very accurate now.

I could add an additional node. But it is inefficient by adding more nodes. I will prefer to have a very efficient flow, since our task is CPU intense :joy:

Is it possible to add an option to the schedule node to just fire once?
In our case, it is in-efficient to add additional node to remove the constant messages.

I have to think about it a little more, it's definitely possible.

Also, the node currently has two modes. If you would switch to the Event Mode - it actually only fires at the time specified. Maybe this would work for you as well?

Thanks Fellinga, The event mode indeed only fires once. The drawback is that I have to add the "off" event separately :joy: This node is definitely very useful if the timing can be more accurate (e.g., start from full minute).

It is hardly inefficient - unless you are running 10,000 messages a second in the rest of the system constantly one extra message per minute is not going to affect you.
The whole point of Node-RED is to use nodes for what they are best at - the RBE node is there to remove duplicates - use it and move on.

In my case, there are ten schedulers, so there are 10 messages generated per minute from the schedulers. We could add more scheduler down the road.

When the system is running full speed, there are lots of sensor messages coming in. That's why it is ideal to have an efficient flow.

I think for the moment, the event mode should be fine, which only fires once. Though we need to set the "on" and "off" separately :grinning:

1 Like

@davidz I just released v0.4.2 - timing should be very accurate now.

1 Like

Wonderful. I will start using your node now :heart_eyes:

Found a minor bug: When there are multiple events and I edit an existing event, for example "event 1". After editing, the edited event will be assigned a new number and appear in the bottom of the scheduled event. The position of the edited event should remain the same.

Very nice work.

I've been tinkering with the idea of making a flow to control an HVAC system and realized this node would be perfect for creating temperature profiles except for the fact that it doesn't support numeric (target temperature) outputs. Any chance that capability may be coming in the future? :slightly_smiling_face:

@davidz: The list shows all timers ordered by start time. So modifying a timer (and its start time) can result in a new position in the list. If you only change on to off for example nothing should move.

@gojk Instead of the current true/false only values? If so...Yes, I definitely want to add more flexibility to allow individual outputs in the future. Non static - numeric output could be a bit tricky, since I have to add more elements to the UI - I'll take a look at this this week.

Yes, exactly. For my use case I would probably want to define multiple single events, each one outputting the target temperature to go in effect at the given event time.

The beauty of your node over other "thermostat" nodes is the convenience of being able to use the dashboard to modify settings on the fly.

Have a look at:

This might do exactly what you want.

Johannes

This is not the case for the event mode. Attached please find a picture that I edited the scheduled event in the first row. I changed its start time to an even earlier time. After I edited the first row, it changed its position to the last row. See attached picture.

I saw your flow some time ago and totally forgot about it. Yes, I definitely need to try it. Thanks JGKK!

1 Like

just released v0.4.3 :tada:

@davidz I found the sorting bug, it's fixed now (I also fixed the circles).

@gojk and @JGKK This update also enables custom payloads for the event mode, let me know how you guys like it!

1 Like