BigTimer – Scargill’s Tech Blog

Node-RED is a fantastic and powerful yet easy to use programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. For more information on Node-Red go to the Node-Red site.

BigTimer is the the most
powerful and best-ever, most comprehensive timing node for Node-Red, providing a general purpose timer as well as handling summer/winter correctly as well as (importantly) lighting-up time (for which you should provide your longitude and latitude from Google maps or similar).

After all you probably don’t turn the outside lights on at 6pm!! You most likely want them on when it gets DARK.

At it’s simplest, BigTimer can be used as the equivalent of a simple mechanical timer, deeding other Node-Red nodes or directly manipulating devices by, for example, MQTT protocol.

BigTimers can be used singly or in groups. Full support is provided for dusk/sunset dawn/sunrise and variations also for day/week/month (and special days) control.

BigTimer has three outputs, the first of which updates when there is a change of state and presents one of two messages (for, for example, MQTT or other control mechanism)

The node offers outputs suitable for MQTT, speech and databases (but you don’t HAVE to use any of these). You can also manually over-ride the UTC time setting on the host computer if required.

The second of three outputs offers a simple 1 or 0 every minute in the output “payload” and also presents additional information reflecting the status message in msg.state, message.time and others – see the entire msg object output in debug for more.

The third output presents a message which could be used for speech or debugging.

There is also real-time status information displayed below each BigTimer node.

As always, the latest node-red-contrib-bigtimer is available at node-red-flows and at – put “scargill” in the search and you’ll see all my nodes and flows.

Back in February 2018 I added moonrise and moonset – as well as improving the layout and docs. The “moonrise” code in module sunCalc seems less than perfect so although I added the moonrise and moonset properties in 2.1.3 BigTimer, there were issues resolved in moonrise and moonset (from version 2.17 on) thanks to adding my own checking to the sunCalc module.

Recent additions/changes include timestamp on outputs, additional on/off inputs, improvements to “timer” input option (default seconds) example:

timer X (mins)

timeoff X (mins)

December 9, 2018. Recent features include a seconds timer and even/odd day of the month selection. December 2018  I note I have not yet documented the timer mode – so here goes. In manual override (injection), assuming the timer is off, inject “timer 30” to turn it on for 10 seconds. This is also handy if you have lights turning off at midnight for example and you need an extra hour of light  and don’t want to have to remember to turn them off at the end of that period. Inject “timer 3600”.

Update November 25, 2017 – added “toggle” override mode and as I recently realised that the little icon was not quite the right format and might look odd on some people’s systems – something pointed out by the FRED people who want to use my nodes… I’ve updated node-red-contrib-bigtimer, node-red-contrib-timeout, node-red-contrib-diode, node-red-contrib-grove and node-red-contrib-esplogin and also moved them from the “scargill” category to the “advanced” category.

What: Node-Red-Contrib-Bigtimer is both a simple timer – and a full-function timer – depending on your needs. At it’s simplest, you set on and off times, the topic and payload you need to go out to, say, MQTT and your longitude and latitude (most browsers will fill this in automatically), you then set your schedule and you are done.

Why: Existing timers didn’t do what I wanted – also – I have a watering system – I want it to run at dusk and dawn every day – but not in December through February (ice)!  I had to have control over both days of the week and months. Existing timers didn’t do that either. Many seemed to be based on the old mechanical timers but without moving parts. That won’t do.

Firstly: the name. It’s a timer – but it’s a BIG one – so I’ve called it BigTimer. (note: the original “Scheduler” node is no longer developed – BigTimer does everything Scheduler did and much, much more).

Secondly: it has an input. You can inject various words into BigTimer – and get instant over-ride action. “1” or “on”, “0” or “off”. “auto” or  “default”, “timer”, “sync”, “manual” etc.

Does that need explaining? “on” for manual override to on, “off” for manual override to  off (both of which reset on the next auto state change), “default” or “auto” to return the timer to normal operation. More details further on.

Manual Override: If you set the timer to turn on, say at dusk and off at midnight, you can override the setting during the day by sending “on” to the input. This override will reset at the next auto change of state. Please no

Leave a Reply

Your email address will not be published. Required fields are marked *