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:
I tried the node and found two problems: (These are the reasons that I did not use this node in our implementation):
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?
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
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.
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.
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 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.
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.
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?
@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.
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.