BigTimerNodeRED 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.

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

BigTimer is my own creation and is (IMHO) 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 (i

mportantly) lighting-up time (for which you should provide your longitude and latitude from Google maps or similar).

THIS page is the home of BigTimer. Questions about BigTimer should be placed in the comments section here. I’m currently pondering how to add winter and summer options for on-off times without making the setup page more cluttered – ideas welcome.

I do not plan to spend any more time hunting through Node-Red forums for BigTimer queries, sorry… and the source is NOT in GITHUB  – you have the full source when you have BigTimer itself – the whole thing is only 2 files (a .js file and an .html file).

In version 2.5.0 I added separate on-off randomisation options.

The panel on the right is quite out of date now with many additional items in the actual panel.

For clarity: BigTimer works in minutes – in a DAY which consists of hours and minutes 00:00 to 23:59, where minute 1439 is the last minute of the day – that is why there is no MIDNIGHT in the settings. If you need something to happen at or near midnight –  I’ve now added a DAY END option to the OFF dropdown boxes – equating to 23:59 or one minute before “midnight” (the latter is in fact is the beginning of the next day).

At it’s simplest, BigTimer is a single block which can be used as the equivalent of a simple mechanical timer, seeding other Node-Red nodes or directly manipulating devices by, for example, MQTT protocol. The MQTT-compatible payload (ON and OFF msg)  is the main output and you should put a value in there even if not using MQTT. ON and OFF TEXT fields are optional – for speech or whatever use you have in mind.

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.

I’ve had the odd comment about BigTimer not giving the output someone wants… if the msg.payload from output 1 isn’t what you need, change it. Let me give an example, the segmented switch in BLYNK, assuming 3 outputs for this example – gives and needs values “1”, “2” and “3” – which I use for “off” “auto” and “on” states in BigTimer. A simple function node on either side of BigTimer sorts out that problem.


Note the Blynk “Write Event” node on the left and the Blynk “Write” node on the right.

The functions are easy. Blynk might be controlling the lighting or the grey manual overrides, OR BigTimer may be running a schedule – it is important that all 3 methods are compatible and that they stay in SYNC.

First function node:

if (msg.payload=="1") msg.payload="off";
else if (msg.payload=="2") msg.payload="auto";
else msg.payload="on";
return msg;

Second function node:

if (msg.state=="off") { msg.payload="1"; return msg; }
if (msg.state=="auto") { msg.payload="2"; return msg; }
if (msg.state=="on") { msg.payload="3"; return msg; }

Easy – I have a ton of variations on that for different scenarios.

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)

Features added in December 2018 include a seconds timer and even/odd day of the month selection. In manual override (injection), assuming the timer is off, inject “timer 30” to turn it on for 30 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”.

As early as 2017, I added “toggle” override mode and as I then 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 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 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 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 note: “night” and “endNight” are included for completeness but are not guaranteed to work depending where you are in the world. Perhaps better to stick with dusk/dawn, sunset/sunrise etc.

If you inject “manual” in conjunction with  “on” and “off”, the state will change until the set timeout (in minutes) times out – so if you turn the lights on in manual mode (as against simple override) and forget you did it?

The unit will return to default operation in X minutes (which you can set – defaulting to 24 hours – 1440 minutes) after any manual change you make.

You can also send a “sync” command which simply outputs the current state with a side effect of decrementing the timeout counter – handy for testing.

Here is a test setup for BigTimer, just using simply injection nodes:

BigTimer test setup

And here’s what happens if you manually press ON (a simple inject  in this example – you can send that message in the payload by any means you like)…

Bigtimer test setup[6]

But what are those other two outputs?

Output 1: is a message – you control the topic and payload – so I use it, for example, as I do, to send a message to MQTT to control something. You can have this message go out once – or every minute. There are other components to the msg object on the first and second outputs, use these extra messages or not as you prefer.


In this example (version 1.5.5 of BigTimer onwards) you see various items in the output -also note that this view is in Node-Red 0.18.5 – I strongly recommend you upgrade if using an earlier version.

You can see the value in msg.payload which is whatever you enter in order to fire a message off to another node or function to make something happen. In addition (and not essential for normal operation) we have msg.state, msg.value, msg.AutoState, msg.manualState and others.

For simple use, you can of course ignore the additional outputs, but they are handy for checking. msg.state shows “on”, “off”. “auto” or “none” and in the case of the first two outputs, msg.duration shows the time until the next change of state and shows the time in minutes since midnight.

Output 2: outputs a 1 or 0 every minute when checking (in msg.payload) – you can use that to light up something.

Output 3: puts out another text message in msg.payload which you can set – I point it to a speech synth so it might say “external lighting coming on”. There is one message for the ON state, another for the OFF state. Ignore it if you don’t have a use for it.

December 2018: Typical use of BigTimer in my home, controlling ESP8266 and other devices and accepting control from manual overrides either directly in Node-Red or for example in the Node-Red Dashboard (mobile or PC screens).

BigTimer use in my UK home

And to get this node?

Make sure you are in your Node-Red installation folder (for example /home/pi/.node-red) and type:

npm install node-red-contrib-bigtimer

So in my case, I keep all my nodes under /home/pi/.node-red/node-modules.  So I do the install from /home/pi/.node-red

Restart Node-red and Bob’s your uncle – it should appear on the left with the other Nodes.

Actually today (in 2020/2021) there is no longer any need to use NPM install; simply install using the palette manager in Node-Red itself.

In addition, I have recently, as a response to a sensible request from one of our blog readers, changed the code so that if either the ON payload or OFF payload is blank – then no message will be sent at that time – this means you can now easily OR timers together. So if you need several time intervals in a day or other complicated setup you can simply use a number of timers and feel the first output to one common destination!

Here’s an example of TWO timers simply sending stuff to a debug node for testing…


Backtrack for Beginners: Node-Red is a simple-to-use but very powerful visual tool for wiring the Internet of Things and a tool for connecting together hardware devices, APIs and online services in new and interesting ways. It is also a lot of fun.

I control a range of ESP-8266/ESP32 devices using RPi4 (though older versions of RPi work well). You can of course run Node-Red and the other tools on a wide range of machines – Orange Pi, Odroid C2 etc using Debian, DietPi, Xenial etc. I’ve even had my normal installation script “The Script” running on a laptop using Mint Linux (some time ago).

On this particular RPi I run MQTT (Mosquito with Websockets), SQLITE, NGINX and Node-Red. I started using Blynk as my mobile remote controller then went on to using ImperiHome then Node-Red Dashboard which has (IMHO) so very much potential, however it also has lousy RGB control so for a while I reverted back to Blynk.  I then used Nextion touch-LCD display devices for local displays and now (2021) I use low-cost ILI9341 displays with ESP-HOME, the code talking back to Node-Red. All of this can be managed within Node-Red. If you find this interesting you might like my old  home control 2018 post here or the early Nextion Wi-Fi Touch Display article.

Above is a screenshot of a typical setup… click on the image to enlarge.

So in total you have a timer you can set to go on and off at specific times of the day, or dusk and dawn, on certain days, certain months, you can even set it to run on specific days of the month (Christmas day?) or even certain weekdays of every month (second Tuesday) – as of version 2.0.0 (August 2018) these can be included or excluded.

You can tick a box to have output on power-up or not, you can tick a box to have the node auto-repeat the message every minute or not. You can add positive and negative offsets to the times (including dusk and dawn etc.), you can optionally add your OWN offset to the UTC time of the host computer and you even select a random value within the limits of the offsets (security lighting etc.) You can temporarily suspend the schedule via a tick box or a message.

And here are the words the node will accept at the input to override automatic operations. The input is not case-sensitive.

sync simply forced output
on or 1turn the output on
off or 0turn the output off
default or autoreturn to auto state
stopstop the scheduler
on_overridemanually override the on time ( specify time as minutes or hours:minutes) – also if you specify the time in minutes, you can use special values like:

off_overridemanually override the off time( specify time as minutes or hours:minutes) – also if you specify the time in minutes, you can use special values like:

timera recent feature allowing manual override for X seconds (timer X) – handy for watering systems etc.

In August 2020 I added geo_override, fixed some minor “timer” issues and also with help from one of you – added on_offset_override and off_offset_override – updating the second output message accordingly.

In the drop-down boxes for on and off times you can select times or words like dusk, dawn, sunrise, sunset, night etc. All are dependent on the longitude and latitude you put into the relevant boxes and will adjust every day as necessary.

A good way to learn about BigTimer is to put a debug node (set to show the complete message) on the top output – and inject text payloads (using the INJECT node) to the inputs as demonstrated above.

Output from error and warnFrom the first output, as well as the normal msg.payload, you can extract msg.state which might be “on”, “off”, or “auto” – and msg.value which might be 1 or 0.  This is so that if you are using say, ImperiHome and store states in global variables, if the time reverts back to auto, you can let ImperiHome know what is happening.

Another way to test BigTimer  is as follows..

Big Timer Node

In the FUNCTION nodes to the right of BigTimer, I’ve simply put node.error(msg); and node.error(msg); respectively. The only difference is one has a red bar (error) the other a yellow bar (warn). These make a handy alternative to using the debug node for testing.

Recent additions to the inputs include on_override and off_override. These are in response to requests to be able to change the on and off times from the Dashboard. Please note that override information you inject here (in hours and minute or just minutes, space-delimited) is lost when Node-Red is restarted or the board rebooted.

Not shown on the photos above are two new options – to kill the output on even days of the month, odd days (or of course both).

If you make good use of this node – please put a link to this blog entry somewhere in your writings so people will come back here. Or if the node proves REALLY useful you could feed my Ebay habit – there’s a link on the right of the blog.

See the Node-Red info panel in Node-Red for up-to-date information.

Enjoy and please do report any issues back here.

If you like this post – please share a link to it by social media, by email with friends or on your website.
More readers means more feedback means more answers for all of us. Thank you!


1,188 thoughts on “BigTimer

  1. Hi Pete I have installed several nodes now on my raspberry pi. Including Big Timer

    I’m typing

    cd $HOME/.node-red
    npm install

    They all appear to install correctly but none appear in the left hand pallet on the web page.

    The Npm has loaded them all into a directory in my home directory called nodemodules (from memory) anyone else had issues like this ?

    Much appreciated.

    1. If you are in the .node-red directory and you type for example

      npm install node-red-contrib-scheduler

      They SHOULD end up downloading and installing themselves in .node-red/node-modules

      If that is exactly what you have done – and they’re still not there – try asking the guys at the Google+ Node-Red forum.

      Another way is to move the directories to under .node-red/node-modules – that might do it and if not – having done that go into EACH directory and type npm install
      The latter on it’s own with no arguments assumes you already have the stuff in place.

    2. I have never gotten to the bottom of the general package.json… talk to the guys in the Google Group Node-Red about that. As you say, just install anyway and you’ll get the latest version. I’m very pleased with it and keen to hear any feedback.

  2. Just moved the modules to node-red/node-modules & most have appeared in the pallet now. Npm still puts files into my home/pi/nodemodules folder but for now it’s not an issue moving afterwards. Thanks for your support and interesting blog Peter.

    1. And thank you for taking an interest. Latest update I’ve moved all my nodes into my own section – again move to .node-red dir and do npm install node-red-contrib-XXXXX where xxxx is bigtimer, scheduler, grove, thermostat, esplogin. Bigtimer the most useful. That command also does for updates…

  3. Just to follow up on this I found if I installed packages like this CD into directory

    cd $HOME/.node-red

    And then

    sudo npm install -g package-name

    The packages were then installed in the correct directory
    I followed the official install procedure for the raspberry pi when installing nose red and installed it as a global user so the -g switch puts the nodes in the correct directory

  4. After install bigtimer, as soon as I open a new node red page and before click on anything, I can see the small bigtimer icons and checkboxes aligned in the left side and bottom of the page. And when I select the bigtimer icon it only shows a box with the option to change it´s name and nothing else… Any ideia of what is wrong?

      1. Ah, excellent – well I’m glad someone is having a good day. Once again my limited knowledge of Linux is getting in the way. I’ve spent the afternoon getting Java 9 running on my diskstation so I can run BLYNK on it – works a TREAT – but can I HELL figure out how to make it run on startup – the Synology Diskstation is VERY different to the PI!

  5. Just an idea you can fire up a terminal on the synology I guess that’s how you installed your software. What about adding a cron task to run your BLYNK at startup. I’m sure I have read you can access Cron from the terminal on synology . Cron can also be used to run items on a schedule node-red uses it on the inject. On the pi you type sudo crontab -e should be something similar on synology put an entry in Cron “@reboot” then the path and program you want to run. miss the quotes. Have a google above might help J

    1. Thanks for that but no… as I’ve come to expect from the Diskstation… “ash: crontab not found”.

      It doesn’t have GIT or APT-GET … it’s quite difficult to do anything – but I’m so near with being able to run the thing in the terminal…. (yes I have SSH access).

  6. Thanks for that Jason, will progress this further in the morning – really appreciated – but… the last link – that’s where I started! No joy with that.

  7. Hello – I’m playing around with NodeRed since a while for home automation – today I found this promising module – I installed it to my global space with “-g” same as node-red. I can us it in the graphical editor – setup all the parameter – but I’ll never get a message in first or 2nd output -> I only get a “-2” on the last one. I’m using latest node-red version 12.0. Any know issues with that? I also tried you scheduler module – same result- Any idea?

    1. Yeah, I’m seeing the same thing here. Second output gives me this every minute:
      { “payload”: “-2”, “topic”: “status”, “_msgid”: “f7338f4b.08cc7” }

      The other ones gives me nothing.

      Any suggestions where to start looking? I tried npm update to make sure I’m on the latest version.


      1. I just tried BIGTIMER on a brand new installation which got all of it’s nodes from NPM. And this time it’s not even a Raspberry Pi, it’s an Orange Pi.

        I pulled in bigtimer (it asked if it could use my current position – I said yes) – I set the on time to 5 minutes from now and the off time to 35 minutes from now. I tied outputs 1 and 2 to a debug.

        I set the ON message to “hello” and the OFF message to “Goodbye”

        I started it – immediatgely in the debug window it said “Goodbye”. A minute later a 0 appeared in the debug – another minute later another 0 appeared in the debug.

        That is absolutely the correct behaviour.

        1. Hi and thanks for your reply,

          Did some more tests… I uninstalled using npm, cleared the cache and reinstalled.
          I then made sure I had all fields populated in the node, however I still got the same results.

          I then tried removing the node completely from my tab and readded it. I’m now seeing messages looking much better every minute from the second output!

          2016-02-06 10:20:12dc2586e1.23da78
          /test : msg : Object
          { “payload”: “0”, “topic”: “/test”, “_msgid”: “601a85b.f9fe57c” }

          2016-02-06 10:20:12dc2586e1.23da78
          status : msg : Object
          { “payload”: “0”, “topic”: “status”, “_msgid”: “601a85b.f9fe57c” }

          2016-02-06 10:21:10dc2586e1.23da78
          status : msg : Object
          { “payload”: “0”, “topic”: “status”, “_msgid”: “570a3aab.a8f5c4” }

          So today I learned that readding nodes to a project is a good thing to do before contacting the developer! 🙂

          Thanks for an inspiring blog!

  8. Dear Peter,

    I have a suggestion for improvement. I do not know if you know, since years I have developed a number of so called plugins for EventGhost. One of those is named SunTracker and is in some way comparable with your BigTimer.
    However, there are two features I really think would be valuable to have also in the BigTimer, two more day types. We can call them ‘Vacation’ and ‘Away’ (or ‘Empty house’).
    In SunTracker I can have different settings for those two day types. During ‘Vacation’ I personally have completely different settings for lights and other stuff then during normal weekends (so Saturday and Sunday settings will not work). Also when ‘Away’, I have again different needs.
    Let’s assume you would have settings for those additional day types. To activate them you could have an additional input accepting the values 0, 1, 2 (0 = Don’t bother, 1 = Vacation, 2 = Away).
    In this way you could externally set the mode of your system/house very easily using whatever node signals (like external calendars or home alarm system). You would also be able to manage special holidays (like we just had with Christmas and New Year)

    As I said, just a suggestion,

    Best regards, Walter

    1. Came here to say the same. BigTimer is great, but a ‘vacation mode’ with random on/off periods (with a settable min and max) during the overall ‘on’ period would be awesome. Right now I’m OR-triggering BigTimer with another module for that functionality.

      1. Unless I’m reading this wrong – we’re looking at a duplicate set of settings – and there are a lot in there already, I think the whole interface would get a little unwieldy if I did that. As for random periods – that’s been in there for ages. Tick the random flag and instead of the offsets being fixed – they are randomised. So you could have the lights come on at 10pm – with an offset of 30 mins – tick the random feature then that becomes an offset of UP TO 30 minutes.

        Or’ing 2 Bigtimers gives you your randomised away days…

  9. Hi.

    Thanks for providing Bigtimer. I like it but have stumbled upon a problem or perhaps I am misunderstanding something….?

    At 11pm, if the humidity is above 70% in my lounge, Bigtimer turns on a de-humidifier until either the humidity has dropped or it is 6am. This works well but i also have another Bigtimer session that turns on the de-humidifier between 9am and 3pm as long as no-one is at home (global context variables set by ping).

    I need both instances set to “repeat” because they must check different variables throughout their active time BUT they seem to continue checking even when they should not be active (i.e outside of their ON / OFF cycle). This means that the night time Bigtimers spends all day spewing out a 0 because it’s not night time. The 0 triggers an RF433 signal which sends the off code to the plug socket. BUT then the daytime Bigtimer sees that noone is home and turns it back on etc etc…

    Is there a way to make Bigtimer completely inactive outside of the ON / OFF times but repeat during active duty?

    I hope that makes sense. Regards, Don

    1. Hi there

      Ok the reason I did this – some devices remember their state after a crash or power failure (mine do) but some don’t.. hence I put that in so that they would continue to get a reminder of the state they are supposed to be in – regardless of whether it is on or off.

      Now, I’ll grant you – those devices that are being controlled directly are likely to default to OFF if they don’t have a memory.

      I could therefore change bigtimer – but there is a better way…. and one you can implement immediately.

      So stick a function after bigtimer – if it gets a 1 – pass it on… if it gets 0, only pass it on once then set a flag not to send 0 again until there has been at least one 1.

      If you get my meaning. Simples.

        1. hmmmn. i said simples forgetting that I’m new to this,,,, I have been trying to write a function as you suggested.
          injecting a 1 works fine but injecting a 0 afterwards gives me the “nothing to see here” even though the var “count” should be at 1. do you have a minute to tell me what I’ve done wrong please Peter?

          var count;
          if (msg.payload ==1){
          count =1;
          return {payload:16738315};
          else if ((msg.payload ===0) && count ==1) {
          count ===0;
          return {payload:16738314};
          else {
          return {payload:”nothing to see here”};

          1. I assume you meant count=0; not count===0; which is merely a comparison.


            var count;
            if (msg.payload ==1){
            count =1;
            return {payload:16738315};
            else if ((msg.payload ===0) && count ==1) {
            count =0;
            return {payload:16738314};
            else {
            return {payload:”nothing to see here”};

  10. Hi Pete,

    Do you have an example of using “bigtimer” to schedule more than one on/off event for a device per day? I have an aquarium lamp I’d like to run from 7am to noon, and 5pm to 10pm. I tried creating two bigtimers, one for the morning and one of the evening, but they fight each other, one constantly sends an ON event, the other an OFF event.

    1. Erm untick the box so they don’t send stuff constantly…. the first output will then only send info when due to turn on – and when due to turn off – that way they won’t conflict.

      Alternatively if you really HAVE to have the message repeated, use different messages for each of them (ie for example bt1_on, bt1_off, bt2_on, bt2_off) – feed those into a function and do a little logic on that before firing out the right message out of the other end.

    2. It would not be THAT big a deal to add another on-off time set to bigtimer – but then someone would want 3 on-off times etc…

      So I think the function is the answer.. will be a little messy set of ifs but do-able.

  11. Thank you for the fast reply! As suggested I whipped up a function, which eliminated bigtimer from the equation.

    Here;s the function:

    It’s fed by 4 injectors, the first calls the function every minute, without a payload, just so it will check the time and override states, and send mqtt as directed. The other three injectors are default, on and off like your bigtimer. on/off set override, default clears the override

    A little clunky, but hey nobody’s gotta see it 🙂

  12. This a great node Peter.

    Would you consider adding other sun events? I use sunset, goldenHour, night etc. Supporting these would allow me to tidy up my flows nicely.


      1. I forgot to add, if the code is somewhere public, I’d be happy to submit a Pull Request etc. Happy to help however possible.

        1. I’m not sure how many people realise this – but when you npm install these node – well mine anyway – you have full access to the source – on a Pi, in home/pi/.node-red/node-modules/node-red-contrib-bigtimer there is an html, .js files … that’s it!

          1. Of course, I was only asking in case the actual project was lurking in github or bitbucket and I could do it via more formal means.

          2. Having taken a look at the code, I think I only need to use dusk offset correctly. For golden hour, -90 minutes for the dusk offset should do the trick.

  13. Hi!
    Thanks for BigTimer!
    But, I have some problems using it. I have the scenario that I want two timers, one in the morning, one in the afternoon. I have configured two BigTimers, sending only the changes, but only one is set to “at startup”, since I got a race condition (one sending “on” and the other “off” at the same time with both checked to “at startup”).
    But, with this configuration, only one timer (the one with “at startup” checked) will actually send an update. The other one will update the node, but not sent any topic.
    This is easy to reproduce by just connecting two BigTimers to debug output, uncheck “at startup” on one of them and set some turn on time in the near future and deploy. One will send an initial state, but the other one will be quiet even when the timer goes on (the node is updated correctly (green dot with text “On for xx hours”) but that’s it).

    1. It is at times like this Thomas that I wish I’d done a huge dropdown with per minute timing.. Sitting polishing my nails waiting nearly 15 minutes for the next trip to prove or disprove your theory.

      However as the 2 timers sit there with OFF status – both of them are showing the TOPIC… so I cannot think of any reason why that would change when they turn to on. I’ll go get coffee while I wait…

      Ok, I’ve started again with REPEAT off… so in 8 minutes I should see both of them come on – the first one (with the startup flag) has already of course sent a message which included the topic.

    2. Thank you Thomas for that – I’ve done some tests – you are absolutely right – and I’ve fixed the issue.

      If you would care to npm install again…. you will find you are on version 1.1.3 which should solve the problem. I’m updating the blog accordingly.

  14. Hi Peter,

    Excellent work.
    I have discovered an odd issue and welcome your opinion.
    I’m in the Eastern time zone (UTC-5). I was having trouble with evening triggers (7pm-11:45pm).

    From looking at the code I believe there is potential corner case in the formula to calculate “today”. The issue I believe is that during time between midnight UTC and midnight in the “negative UTC” timezones. the “midnight” calculated is actually the next day, the result is a negative “today”. For example if it’s 9pm (UTC-5) – actually 2a UTC next day. the Midnight calculation is for the next day so “today” ends up as -180 instead of 1260.

    My quick and dirty solution to resolve my setup was inserting this line right under the today calculation:-
    if (today < 0) today += 1440;

    There are several other ways to solve, including winding back the original midnight calculation a day since the today formula is % 1440 it doesn't matter which midnight as long as it before "now".

    Let me know what you think?

    Peter C.

    1. Peter – would you like to do me a little favour – try your mod out on a couple of other time zones and let me know if it is fine – and I’ll update the file accordingly….. I’ve only ever tried it in Spain and the UK.

  15. Hi Peter

    I want to ask a question. If I want to do something15 minutes before dawn, how can I accomplish this task with your bigtimer?

  16. Hello,
    Thanks for all the work you’ve done on BigTimer. I’ve recently started using it and was wondering if there was any way to either change the current on/off times over mqtt. I use OpenHAB as my front end and am ‘trying’ to use node red as a rules engine(among many other things). Ideally, it would have two more inputs, the first being for the ‘on’ time and the second for the ‘off’ time. I’ve gotten a few projects up and running (i love my sous vide machine) but am still fairly new to all of this. If you could point me in the right direction to accomplish this or have any advice for me i would be grateful.

    1. Not only will I have to think about that one Stuart – I’ll have to ask the guys at Node-Red – I can’t get my head around whether or not I can programmatically alter a setting set up in the web page… hmmm

  17. Pete, good work on Bigtimer. A suggestion: it would be helpful if you included a screenshot of the Bigtimer configuration form (web page) in your write up above so new users can see what the controls look like.

  18. Pete, I haven’t been able to get BigTimer working on my Raspberry. I installed the node around three days ago. I followed the suggestion of Micheal on 02/06 and removed the node from the flow and then replaced it but so far no good. At present all fields are populated and Repeat and At Startup are NOT checked. I have repeated this test multiple times but the results are the same. Last test the On Time was 20:00 and the Off Time was 20:15. All outputs are connected to Debug and the results for the On Timer can be seen here from the Debug column:

    4/25/2016, 7:59:34 PMe695a194.d8cbd8status : msg.payload : string [1]0
    4/25/2016, 8:00:34 PMe695a194.d8cbd8status : msg.payload : string [1]0
    4/25/2016, 8:01:34 PMe695a194.d8cbd8status : msg.payload : string [1]0
    4/25/2016, 8:02:35 PMe695a194.d8cbd8status : msg.payload : string [1]0


    1. Pete, update on 04/26 post, Bigtimer is working big time. I can’t explain why, but it appears that Bigtimer was using UTC time and I am -7 hours US/MST. As you can see in the prior post, Node-Red posted the times in the Debug column as MST thus compounding the confusion. I am still in the process of setting this system up and I did not have the proper configuration for the ntp update, although I did set it as advised in at least one Linux How-to article. Once I reconfigured the ntp server settings and rebooted, Bigtimer was on the same page as the rest of us. Again, I can’t say why exactly, but I can say this appears to be the problem as it has been running a few days now and I can set and verify actions in real time whereas before the 7 hour time delay would not let me see when it fired. Good work and I apologize that I misunderstood the real issue before.

  19. Hey Pete,

    Been following your blog for a year now,… many thanks!

    …for the life of me I can’t get bigtimer to work correctly. timeswitch works fine for me, however I’m interested in the offsets between each on/off time selection.

    Are the offsets valid +or- only between each selection? What is valid input in the offsets. e.g “-20” , “+30”, “2”, “+2”, “-3” ?

    Also, I can’t make any sense of the subscript “On for 03hrs 21mins”. It doesn’t match-up to what I selected. Have you seen this too?


    1. Hi Dan – the offsets are in minutes and can be applied to both start and end times. Yes, +4, -5 etc. If you have a specific example of an issue, give me details and I’ll try it here.

      To test for an issue, at 7.22 in the morning I set a new bigtimer with on time at 8am and offtime at 9am. It comes up with “Off for 00hrs 38 mins” which is correct. I add 10 mins to the offset and… the display changes to “Off for 00hrs 48 mins”. Changing that “on” offset to -10 does as you’d expect and changes the display to “Off for 00hrs 28 mins”.

      It is now 7.26am – I change the ON time to 7am – leaving the OFF time at 9am. It now says “On for 01hrs 36 mins” which again is correct. Setting the OFF offset to 15 mins adds 15 mins to that time.

      All seems perfectly correct to me.

    2. I guess it is worth asking – have you actually checked to ensure the time on your Pi is CORRECT?? Are you also setting correct longitude and latitude in the dialog box (though that should really only affect things like dawn and dusk etc).

      1. Pete,

        I took a look at the code there seems to be an issue with the code for negative GMT (I’m in -5):
        I changed this:
        //var nowOff = -now.getTimezoneOffset() * 60000; // local offset
        var nowOff = now.getTimezoneOffset() * 60000; // local offset

        …and results look better. Should be an easy fix for the “negative ” folks. Thanks again!

        1. Dan

          I’m wondering if just perhaps you started with an earlier version of BIGTIMER – because the version I’m using which is the one which SHOULD be available from:

          npm install node-red-contrib-bigtimer

          ALREADY has that line un-commented. Want to check? In my Javascript, line 101 of he JS file has that line active – NOT commented out.

          Indeed here is everything from line 99 and you’ll see I threw away an older version of the code….

          function(inmsg) {
          var now = new Date(); // UTC time – not local time
          var nowOff = -now.getTimezoneOffset() * 60000; // local offset
          var times = SunCalc.getTimes(now,,node.lon); // get this from UTC, not local time

          var dawn=(times.dawn.getHours()*60) + times.dawn.getMinutes();
          var dusk=(times.dusk.getHours()*60) + times.dusk.getMinutes();

          var solarNoon=(times.solarNoon.getHours()*60) + times.solarNoon.getMinutes();

          var sunrise=(times.sunrise.getHours()*60) + times.sunrise.getMinutes();
          var sunset=(times.sunset.getHours()*60) + times.sunset.getMinutes();

          var night=(times.night.getHours()*60) + times.night.getMinutes();
          var nightEnd=(times.nightEnd.getHours()*60) + times.nightEnd.getMinutes();

          now=new Date(now+nowOff); // from now on we’re working on local time
          var today=(now.getHours()*60) + now.getMinutes();

          /* var nowMillis = Date.UTC(now.getUTCFullYear(), now
          .getUTCMonth(), now.getUTCDate(), now
          .getUTCHours(), now.getUTCMinutes(), 1);
          var midnightMillis = Date.UTC(now.getUTCFullYear(),
          now.getUTCMonth(), now.getUTCDate(), 0, 1);
          var startMillis = Date.UTC(times[node.start]
          .getUTCFullYear(), times[node.start]
          .getUTCMonth(), times[node.start]
          .getUTCDate(), times[node.start]
          .getUTCHours(), times[node.start]
          var endMillis = Date.UTC(times[node.end]
          .getUTCFullYear(), times[node.end]
          .getUTCMonth(), times[node.end]
          .getUTCDate(), times[node.end]
          .getUTCHours(), times[node.end]

          nowMillis += nowOff;
          startMillis += nowOff;
          endMillis += nowOff;

          var dawn = (((startMillis – midnightMillis) / 60000)) % 1440;
          var dusk = (((endMillis – midnightMillis) / 60000)) % 1440;
          var today = (Math
          .round((nowMillis – midnightMillis) / 60000)) % 1440;


          var startTime = parseInt(node.startT, 10);
          var endTime = parseInt(node.endT, 10);

          1. I’m using “_id”: “node-red-contrib-bigtimer@1.2.5”,
            “_shasum”: “309b79e400099880275a3ea47138d7f327d90efc”

            In the code you posted. I removed the minus sign:

            I changed this:
            var nowOff = -now.getTimezoneOffset() * 60000; // local offset
            var nowOff = now.getTimezoneOffset() * 60000; // local offset

            I hope that clears up the change I made; It works perfectly now in GMT-5.

  20. Dan – you are of course absolutely right – don’t know how that crept in – but I’ve now updated the repository with that amendment and a higher version number. Anyone using Bigtimer can update in the normal way. Thanks.

  21. Hi – Avid follower of all the stuff you publish. Not sure if this is linked to the recent discussion re negative GMT etc. But I have today installed latest version of BigTimer on a Pi2 which is correctly set to correct time on BST. Any alerts I set incorrectly calculate time. For example at 15:10 BST if I set a timer to come on at 15:15 and go off at 15:30 under the node the message says “Off for 23 hours 5 minutes”. If I change that to on at !5:15 off at 16:30 the message changes to “On for 20 minutes” even though it still has 5 minutes to go. If I advance all times by 1 hour i.e if I want to turn on at 15:15 and go off at 15:30 the I have to set the timer to on at 16:15, off at 16:30 and then all works as expected. Hope this is clear and correct. Latest versions of node-red, raspbian jessie and your timer installed and all clock times set correctly.

    1. It is a long time since I pieced together that code… removing the minus seemed obvious – yet in fact on test it is wrong – so we’ll need to find another solution for those in negative time zones – I have re-introduced the negative offset and at least here in Spain – the timer works perfectly.

      Version 1.27 – you can get this by simply using npm install node-red-contrib-bigtimer from wherever you did it in the first place, then stop and start node-red (or reboot whichever is easier).

      Looks like a different solution is needed for those in negative timezones – the code is in the bigtimer.js file – if anyone in a negative timezone can test this – would be appreciated – i.e. did the MINUS actually make it right??

      1. Hi – Just to confirm that it is all working fine on BST now – although the randomised offsets had me going for a minute or two. Thanks

  22. Hi,

    Thank you very much for all your contributions to the iot community. I must say is have used many of your contributions as is and/or modified.

    My purpose for writing today is either a miss understanding of the use of the input side of bigtimer or a bug. My apologies in advance for the long message, I just hope I can explain it so you understand. I have been using bigtimer for quite sometime now and only this weekend I have started to use the input input portion of the node. I also saw you posted an update today, which I downloaded. My understanding is there are 4 possible inputs, which are as follows:

    1/on –> to send the ON msg to the output until the node is set back to auto or at the next timed even.
    0/off –> to send to o OFF msg to the output until the node is set back to auto or at the next timed even.
    auto –> to return the node to is originally intended purpose/state/schedule
    manual –> to over ride the schedule and leave the node in its current state until auto is injected.

    This leads me to an issue or misunderstanding I am having with the “manual” command. I placed a bigtimer node on the work flow and I added two inject nodes, one with the string set to “auto” and the other “manual” and I put a debug node on the first output of the timer node. If the timer is in the ON state and I press the “manual” input node I would have expected the timer status to stay ON, but it changes to OFF and goes to manual mode. I found that the only way to have the timer stay on when pressing “manual” was to first sent ON/1 to the input then press “manual”. when I do that the timer stays ON and goes into manual mode. The issue does not stop here, as expected, after I press the “auto” input node the timer state changes to OFF and goes back to normal scheduled state, however, now if I press “manual” I would expect the timer to go into manual mode an stay off, but it does not, it goes into manual mode and goes on. Much like the other way around this, I have to sent OFF/0 before pressing manual if I want the timer to stay off and go into manual mode.

    The question is, do I in fact have to sent the desired state ON or OFF before sending manual? If that is the case then I will work it into my flows.

    Thank you,


    1. Hi – manual means manual – it will NOT allow the schedule to continue. WAY too late at night – but I will study your example in the morning and see if I can replicate what you are suggesting – if I can replicate a problem chances are I can fix it. HOWEVER my understanding is that if the unit is ON (manually) and you switch to MANUAL – it will firstly scrap any ON/OFF and then STOP the automatic features… I’ll check this out and we can ultimately agree on what the various options should be doing…

    2. Ok, no way will I be able to tackle this until the effects of our party tonight wears off but on re-reading it – assuming what you’ve said is correct there has to be an issue there – if it was on auto – and ON – and you switch to manual… bigtimer really should stay ON.

      Meanwhile if anyone wants to look at the .JS file, happy to let someone else spot the “deliberate mistake”.

    3. Remember I did 2 updates – one to correct negative timezones and the other to revert back!!! Negative timezones still need looking at.

    4. You are RIGHT – that is the WRONG behaviour – so if in auto and ON – when you inject “manual” it turns off – it should NOT do that it should stay ON. Bear with me.

      1. Hi Peter,

        Oddly though if you inject ON before you inject “manual” it will remain on and go into manual mode.

        WRT the time zone, I had noticed an odd problem with time zones a few months back. If I put my time zone to ET (-5) and say the timer has less than one hour until the next scheduled state, rather than show ON for <59 minutes, it would show ON for 24+ hours. I'm not sure if that is the time zone problem you are referring to.

        Thank you again


  23. Ok, BIGTIMER version 1.28 – should now have that auto-manual combo issue eliminated.

    If you are ON in auto – then switching to manual should STAY on. If you are OFF in auto, manual should STAY off.

    If you have set a 1 or 0 manually – then the manual button should respect that – whereas auto will reset to whatever auto was doing before you messed with it.

    Any testing on this version would be appreciated..

    My normal way to install – might be different for others is to go into the .node-red folder and..

    npm install node-red-contrib-bigtimer

    Then restart Node-Red and you’re off.

    Right- I’m out for the day – any feedback welcome.

  24. Hey Pete,

    On the negative timezone issue, can you (anyone) test this. I made this change and it still works for me in GMT -5.

    var nowOff = (now.getTime() – now.getTimezoneOffset()) * 60000;


    1. Might be better if someone who is actually in a negative time zone tries it.. – I’m at a loss as to why it should make any difference.

  25. See updates (end of article) – I’ve just realised that when using ImperiHome to override auto – when that override timed out – there was no way to let ImperiHome know that we’d returned to auto. Sorted.

  26. Hi Peter,
    I wondered if you could consider a couple of new features?
    1. If there had been a power cut, or the program was just started It would be useful to stagger devices being turned on because of the load. So a delay xx before the timer starts from Pi start or program start would be good.
    2. A time off and a time on perpetually. E.g. xx minutes on then xx minutes off.

    Both would operate within the normal on off times as already defined.
    This is for my fish tank.

    1. On 2 – I can do {out0:6,3} which is turn on for 3 minutes then turn off…. I do anything more complex than that in Node-Red – which has proven so reliably on the Pi I’ve not seen a need to put that on the actual ESP – but no reason at all why not.

  27. Hi Peter, I’m usign a lot you node so thank you as it smplifies my setup for home automation!
    I small feature I’d like to have is possibility to send to my GUI (actually a mix of contribu-ui and thml webpage) the message that you have in “node status” (so to know when the timer will go ON, OFF or it’s current status).
    I know already the status but only because I trigger it and same time I sent message to my MQTT but would be nice to show in my dashboard something like “Garned lights will go on in 45minutes” or “Garder water system will turn off in 20 minutes” and so on 🙂

    1. Good evening Giovanni

      In this case that’s so useful that your wish is my command.

      Update to version 1.2.86. In the object sent out by the centre output every minute, you will now find msg.state and msg.time

      The description explains this. The state – on, off or none and the time in hours and minutes as lifted from the node status,

      You’ll note I’ve also updated this blog if you refresh your browser.

  28. Hello Peter,
    It’s me again 😉 Hope you are doing fine!
    As you might remember we discussed some topics earlier regarding your nice Big Timer node.
    Looking at your new version, I can see that you are now also supporting additional input words like ‘manual’.
    I do have some questions related again due to the specific use cases I am running in my home automation.
    My flows need to be able to switch the big timer modes from manual off -> auto -> manual off again. This is getting a bit complicated since I cannot send just one message when switching mode.
    If possible, it would be very useful if you also could have support for the full input strings ‘manual on’ and ‘manual off’ (the function should be the same as if you would send those words as two separate messages to the input)

    Myself, not very experienced in javascript, I found a very useful on-line tool for checking the syntax of javascripts. It helped me a lot. If you copy & paste bigtimer.js code and run the tool, you will see some warnings coming up.

    Kind regards, Walter

  29. I think the following code could do it:

    case “manual off” :
    case “MANUAL OFF” : if ((temporaryManual==0) && permanentManual==0) manualState=autoState;
    change=1; manualState=0; temporaryManual=0; permanentManual=1; break;

    case “manual on” :
    case “MANUAL ON” : if ((temporaryManual==0) && permanentManual==0) manualState=autoState;
    change=1; manualState=1; temporaryManual=0; permanentManual=1; break;

  30. Hi Pete,
    firstly thanks very much for your always insightful, very intersting blog; I eagerly await new ‘episodes’ daily!

    I ‘ve been working with Node-RED for a while now and was excited to learn about your BigTimer node which I’ve finally been able to use but I couldn’t get the dawn and dusk events to fire at the correct times.
    After reading this long series of Qs and As and a bit of verification using the TryIt Editor from, I found the problem. A new Date() object is already in local time so there is no need to calculate the timezone offset and apply it to var now in lines 100 & 114 – which I have commented-out.
    I validated this change by using a debug node on output 2 and dumping the whole msg object where you’ve helpfully inserted the current local time in minutes.
    e.g. at 21:54MST GMT-6 where the timer is set to turn the bookcase lights off at 23:00:

    { “payload”: “1”, “reference”: “:Bookcase Lights On:Bookcase Lights Off:1314”, “topic”: “status”, “state”: “on”, “time”: “01hrs 06mins”, “name”: “Bookcase Lights Timer”, “_msgid”: “d5d50b60.2a2af8” }

    Or my dawn/dusk timer that feeds a function to set a global day/night indicator:

    { “payload”: “0”, “reference”: “:dawn:dusk:1314”, “topic”: “status”, “state”: “off”, “time”: “07hrs 22mins”, “name”: “Dawn And Dusk Events”, “_msgid”: “e39d7c14.1c628” }

    Platform: Pi3, Jesse, timezone set to Americas/Denver (MST/MDT)

    I’d like to hear if this works for those in other timezones and on other OSes like Windows.

    All the best, Simon.

  31. Hi Pete,

    I’ve been playing with Big Timer for a few days and was wondering about the source of sunrise/sunset/dawn/dusk/night/night-end information.

    Firstly sunrise/sunset – I entered latitude/longitude of a location nearest to me from the Met Office web site. The times Big Timer switches on and off are close enough for what I need but actually a minute or two different from what the Met Office show on their website – curious.

    Secondly dawn/dusk/night/night-end – to be honest I was intrigued by these options as it had never occurred to me what dawn/dusk actually were (they were just terms I’d heard used) or even the actual definition of night. I’ve since looked it up and things got even more confusing – it seems there are several stages. From sunset we then enter a period of civil twilight ending at civil dusk…then nautical twilight ending at nautical dusk…then astronomical twilight ending at astronomical dusk (start of night). Then, of course, we have the reverse for night-end through to sunrise….

    So if I use dusk/dawn, which ones does Big Timer use (civil, nautical, astronomical)? Also night/night-end get a bit tricky for latitudes above 48 degrees (or thereabouts), e.g., the whole of the UK – around the summer solstice the UK never enters night (technically speaking) as the sun is never more than 18 degrees below the horizon, i.e, we only get astronomical twilight. Consequentially we don’t have astronomical dusk/night or night-end/astronomical dawn. Fun isn’t it? 🙂

    I’ve had Big Timer running on my Pi Zero for a few days and set for a dawn switch off – I happened to be up at 4:45am when it triggered (about 45 minutes before sunrise) and there was a reasonable amount of light despite being overcast but I can’t quite work out which dawn it was (astronomical, nautical, civil).

    Anyway, that was a bit of a ramble. It’s for a home lighting project and there’ll be a luminosity sensor connected to an ESP-12F module in the mix as well but I’m curious to know if you can explain further about the various data for sunset/dusk/night etc.


    1. Hi Brian

      The one thing I cannot explain – is the dusk dawn stuff as that’s a library that I found already in use in a node in Node-Red and grabbed accordingly – I’m not aware of a better library for use with Node-Red – the lights here in Spain seem to come on at a reasonable time – and also when I’m in the UK – of course I have no doubt this could be improved. When I compare the times with those in the various online charts they seem near enough.

      1. Hi Pete,

        Well I did what should’ve seemed blinking obvious in the first place and set up a test Node-RED flow with 3 Big Timers (one for sunset/sunrise on/off, another for dusk/dawn on/off and of course finally one for night/night-end on/off). DOH! Why didn’t I think of that before?


        Sunset – 20:58 – two minutes later than Met Office but close enough.
        Sunrise – 05:32 – again, two minutes later than Met Office but close enough.

        Dusk – 21:42 – this was 44 minutes after the sunset timer kicked in and during that period there was enough light to carry on ‘outdoor activities’ without artificial light. I’d conclude (in my observation) that in this case, the Big Timer ‘dusk’ setting corresponds to ‘civil dusk’.
        Dawn – 04:50 – as with my previous post there was a good bit of light and I could have gone outside without artificial lighting so I suspect it is ‘civil dawn’.

        Night – 00:11 – this surprised me from an observational point of view. Two and a half hours after the dusk timer kicked in and, in my observation, it had been quite dark since dusk and that was with only a partially cloudy sky.
        Night End – 02:26 – so only 2hrs 15 mins of what was considered night. This tallies with my previous post where I said latitudes above 48 degrees don’t get night at all around the solstice. It’s 6 weeks or so after the solstice now so that period of ‘night’ makes sense. I’ll override the Pi Zero’s clock to set it to June 21st and see what happens just out of curiosity.

        In conclusion, I’m not sure what use I could find for Night/Night-end (who knows, maybe I’ll come up with something). Dusk/Dawn seem to be good trigger points for outdoor security lighting. Sunset/Sunrise possibly best for indoor lighting.

        Just some observations.


  32. Hi Pete,

    Thanks for BigTimer – much appreciated.

    I installed the node (npm install) with no problems on my Pi2 but when I tried installing it on my test box running Ubuntu 16.04 (32-bit as the processor is an Atom N270), I received a few warnings:

    +– node-red-contrib-bigtimer@1.2.95
    +– suncalc@1.7.0

    npm WARN enoent ENOENT: no such file or directory, open ‘/root/.node-red/package.json’
    npm WARN .node-red No description
    npm WARN .node-red No repository field.
    npm WARN .node-red No README data
    npm WARN .node-red No license field.

    I restarted and checked Node-Red, but BigTimer wasn’t listed. The version number of Node-Red on both systems is the same.

    Long story short, I had to do the following to move suncalc into the right place:

    cd node_modules/node-red-contrib-bigtimer/
    mkdir node_modules
    mv ../suncalc/ node_modules/

    After a restart, BigTimer appeared in Node-Red.

    I have only just started working with Node-Red so maybe I missed out something, but I thought I’d mention it in case my fumblings help others.

  33. Pete,
    I have configured the Bigtimer to turn off 7:15 PM but it is actually turning off at 7:16:36
    More than a minute late. The same for turning on.

    Could you check if there is something to tune in the code?

    Best regards, Walter

  34. Pete, regarding turning on, I think the offset is just the seconds, it seems to be more accurate then turning off

  35. So here is additional logged info

    Date & time is from inside the same rpi where node-red runs on. ‘State’ is what bigtimer delivers on 2nd output (0 or 1). Configured to turn on at 7:30 am and off at 7:45 am

    When State === 0 and then turning ON
    2016-09-12 07:28:11 State: 0
    2016-09-12 07:29:11 State: 0
    2016-09-12 07:30:11 State: 1

    When State === 1 and then turning OFF
    2016-09-12 07:44:12 State: 1
    2016-09-12 07:45:12 State: 1
    2016-09-12 07:46:12 State: 0

    You can see that when turning on, it is within the correct minute but 11 sec late. When turning off, there is a whole minute late plus those seconds.

    So I think you are one minute late when turning off. Also, instead of synchronizing the timer with the clock, could it be that you are starting things on deployment? That could eventually explain those seconds…

    Best regards, Walter

    1. Good morning Walter

      Well, you are right – I was checking >=start or <=end. That is now fixed and within an hour or so you should be an updated version available. As for ultimate accuracy - to keep overheads down the code is checked every minute - hence there will always be some inaccuracy in terms of start and end seconds. The only way around that would be to poll every second and given lots of timers I think the overhead might be a bit much.

  36. I am learning node red and feel I am missing something about timers and triggers. It seems that most timers only allow me to set the time in 15 minute increments. Is it strictly because the widget would get too long if every minute in the day was listed?

    Secondly, I have noticed this in many node-red nodes, why can’t I pass settings either in the payload or as some other attribute? For instance, I wish I could send in a variable delay time or variable start time to bigtimer.

    1. Possobly because not enough people want this to warrant the extra overhead. Node-Red nodes are simply HTML but more importantly in this case – Javascript – if the nodes are not what you want – go to the Javascript and improve them.

      1. Hi Pete

        Tx for all the great work, have been lurking and playing with your stuff for a while now and am looking at making some additions / changes relating to making settings changes to bigtimer externally aka a user and admin mode like blynk has. Basically a scenario where a regular user can make settings changes (start stop times etc) from a UI and/or app.

        I have had an initial look at this and was thinking of modifying bigtimer to add additional inputs to accomplish this.

        Any thoughts on this approach and/or any other ideas to achieve this from your experience are appreciated.

        1. Hi well you can add additional commands – but nodes can only have one input – there’s been plenty of discussions about that and it’s not about to change – but sure – just add more input commands.

  37. Hello Pete,
    Your new version is now working fine (as always!) and is now turning off within the minute.
    Just one input from me regarding the thing with offset of seconds. I think it looks like you are starting the timer on deployment, right? If you would be unlucky, like I was, it was started when 58 sec elapsed. So then I was 58 sec late both for on and off actions. My idea was not that you should check every second, the check should only happen right at startup. Myself, I made a similar implementation once in Python and the principle was that I checked the system time at start, calculating number of seconds to next minute change, then waited and finally fired exactly at the minute.

    Kind regards, Walter

  38. Hi Pete!

    I’ve been doing home controllers with Raspberry Pi’s and my own electronics for a few years now, writing my own apps in Python, learning as I went along. I recently got interested in Node-Red, but before I got around to trying it, I discovered TheThingBox, which runs on top of Node-Red.

    Your Big Timer is exactly what I need – but I can’t see it in TheThingBox – I did npm install node-red-contrib-bigtimer and it returned:

    node-red-contrib-bigtimer@1.2.96 node_modules/node-red-contrib-bigtimer
    └── suncalc@1.7.0

    But after restarting Node-Red, and after rebooting, I still don’t see it. Would you know if it has a problem with TheThingBox? Should I drop TheThingBox and go to pure Node-Red?

    1. I would say there is likely something very wrong with Tbingbix if it will not let you I stall Big-time or other nodes. I use a normal Mode Red and when I do installs I go to the Node Red directory… in my case /home/pi/.node-red

      Once in there I install nodes. I.e

      npm install node-red-contribute-big-time

      And that works every time on pi and other devices.

      1. Hi, Thanks for the fast reply!

        TheThingBox puts nodes in /root/thethingbox/node_modules. When I found it, I did the import again. BigTimer did not appear for a while, but eventually did. I am running on an old Raspberry Pi 1A, so it is probably slower than using a Pi2 or 3, or even a Pi1B, which has more RAM.

        BigTimer is great – exactly what is needed for all those things that need to happen at dawn and dusk. And it is very flexible. Thanks for it!

  39. Hi
    just re-installed “the works” on another sd card using your script, as my old one was in a bit of a state from all the playing (but worked). main reason being after seeing your echo dot, i bought one immedietly, and everyone i have shown it to has done the same. anyway wanted a clear canvas to try and tackle https/ssl (really struggling at moment!). So with clean install i put all the esplogon nodes in place then the very important one, Big timer to switch on my electric blanket!
    i have the on time set to 21:00 and off for 22:30 but It switches on at 22:00. It is now 21:56 and at the bottom of the node it says “off for 00hrs 4mins”.
    It is now 22:00 and it has just switched on, it says on for 01hrs 30mins. An hour wrong.
    if i set the off time to 90mins (on time still 21:00), it says on for 3hrs 10mins….. all gone wierd! have you any ideas, or has anyone else had similar problems?
    my old version is about 5-6 months old and always worked flawlessly.
    i have Lat & long set correctly. offsets at 0.
    also, an unrelated problem on my laptop big timer won’t scroll so i cant get to any of the radio buttons below Jun. i have to use ipad in portrait to get to them
    Many Thanks for all your great work.

  40. Funny enough – everyone WE’VE talked to has gone out and bought a DOT. I do hope Amazon stay on the ball and keep improving it – this thing about accepting words outside of a selection you make it pants – and we’ve not found a way when talking to it by Node-Red to do multi-part commands without having to keep saying “Alexa – tell computer”…. but other than that – it is marvelous – right now I’ve just told it to alert me in 30 minutes when my chicken pie is ready… it is quiet clear I’m going to need one in every room 🙂

  41. Bug or misconfiguration?

    I’ve got several timers in a flow. Whenever they’re defined over an absolute interval, say, 1pm to 3pm, everything works as expected. However if I define start time to sunrise (or sunset) and end time to a relative duration like 60 minutes, the node seems to _always_ evaluate the condition to be TRUE on deploy and come up with some strange duration to wait before turning off again. A clearer example:

    1) I define a BigTimer to run from sunrise for 60 minutes. Let’s say sunrise is at 5am for the sake of simplicity;
    2) I deploy at 10:30am (you’ll see why I’m so specific later); BigTimer fires TRUE (which is contrary to my expectation that it would only fire if within the interval 5am + 60 minutes);
    3) I see beneath the node in the flow “On for 12hrs, 20mins” or something along those lines.

    However, if I change end time from 60 minutes to, for instance, 10:00am (remember the current clock time is 10:30), then BigTimer figures out that endTime < currentTime and the state is FALSE. So it seems to definitely be linked to the relative time offset "60 minutes." Or have I simply misunderstood how this sort of event is supposed to be defined?

    Version according to package.json is node-red-contrib-bigtimer@1.4.1, which I believe is the latest.

    Otherwise it works great. Cheers for the elbow grease

  42. Hi Peter,

    I’ve need using Bigtimer since the first release, in fact I was even using your original scheduler node before that, and must say bigtimer is the most useful node in my tool box. I do have a request. Is it possible to add a feature that will set the start and stop times based on say msg.starttime and msg.stoptime passed in from the input? This would permit setting start and stop times from a web dash board and saved in a database. They can then be passed to bigtimer either at startup or when the setting on the dash board is changed.

    Thank you for everything.


    1. Hi there Mike

      I would love to overwrite the values set in the html – but I’m not even sure that is possible. From things I’ve read, not.

      1. Thank you for the quick reply.

        I’m not very familiar with creating nodes, maybe I should learn in order to help contribute. In any case, how would feeding a start/stop time on the input be different that say feeding a topic to the MQTT node as opposed to putting the topic directly in the node? Sorry for my ignorance, and with that in mind, where can I find more information on creating nodes? I looked at the node-red website a while back and it is not very helpful.

        Thank you,


        1. After thinking about this a little more I understand what you mean. With the MQTT node you are not setting the topic but instead simply passing the topic through the node. Where as the big timer node the time has to be set as opposed to passed through the node.


  43. Hello Peter,
    Thanks for your bigtimer. However, I’m wondering, why does the timer on an inactive day still produce output when I send an “auto” (or default) to the input. I can imagen it will override the output when you send an “on” or “off”.

    Is this the behaviour as you designed it or can we expect an update for this? So an inactive day won’t produce an output if it receives an auto.

    The problem is that I will use different time schedules on weekday’s and weekend’s. (I will override them for the same input.)

    1. I’m having difficulty understanding the problem. If this is an inactive day and you turn the unit on manually, then turn back to auto – then you would surely expect the unit, having turned on manually, to go back to the auto state which of course would be off as it’s an inactive day… or am I missing something here.

      1. The problem is that I uses two bigtimers parallel. One timer is for the weekday’s and one is for the weekends. Both has the same input and same output (MQTT). Because of the different time schedules it is posable that the light is on till 10pm on weekday’s and till 11pm in weekend’s. Only one is active based on the day of the week. Sometimes you wish to override the timer. So I send an “on” or “off” which is great. However if you wish to continue the timer schedule function I send an “auto”. The active timer needs to respond. I found that the inactive timer also respond to that event.
        If that is between 10 and 11pm, one timer send a “poweron” and the other a “poweroff”. I any case the light will flash. I didn’t expect that an inactive timer for a day send an event when it falls back to is original state – which is in this case no activity-.

  44. We have been using your Bigtimer for about a month now. After the latest update, the node seems to have an error while calculating the position of the sun based on our longitude and latitude. For example, we have it set to turn on at Dusk and off at 21:00, but it is showing that it will be on for the next 20 hours. Any help would be greatly appreciated.


    1. Hi Julian

      I added authentication – something I’ve not used before so it was odds-on I’d get something wrong, somewhere. Sure enough – lower case letters only… fixed in version 1.4.7 to allow upper, lower and numbers as well as underscores – give it half an hour. Also fixed an issue in the name which can now be uppercase, lowercase, numbers, underscores and spaces.

    1. I’ve not yet tried this version (tonight). However, one small point that would make life a lot easier with any future parameter changes. I’ve noticed that when you add parameters and I update an existing flow, often I get errors because the new parameters are not pre-filled with defaults.

      Thanks again for the work put into this node.

      Regards, Julian

          1. Well, it may be that someone can help me there – I’m no great whizz at programming nodejs etc…. I’m ok at it – but when it was suggested I add in error checking – the payback for that seems to be that defaults don’t work – which is incredibly annoying as you can SEE the defaults – but unless you put something in, it objects. Anyone want to put me right on that I’ll fix that right away (it’s in the HTML)

    2. Hey Pete, I just found Bigtimer and wanted to use it in my node red setup. However, my mqtt topics have “@” and “.” in them. As soon as I put one of those characters in my topic, it goes red. I believe I can work around this with a function node, but if there is any chance of fixing this in the build, that would be fantastic. I see above that you were able to add underscores and digits, so I figured I would ask 🙂 Thanks!

  45. For me Bigtimer works great to turn on lights 30 minutes before dusk. However, regardless of configured off time it turns the lights off around 1:15 AM the next morning. I’m located in the eastern US timezone.

    I noticed my Bigtimer configuration dialog doesn’t look anything like the one shown in this post. It looks like the one in the earlier Bigtimer post so I thought I must have an old version. I have updated node.js, node-red and all nodes (v7.2.1, v0.15.2). Bigtimer still looks the same and still turns off ~1:15AM. As I started working on home control years before discovering this excellent blog I’m running on an Intel Atom miniITX board using Ubuntu 14.04. Yes I know you are not an Ubuntu fan but that where I am.

    Can anyone point me in the right direction to get Bigtimer working?


    1. Hi John

      Well, Ununtu I cannot even begin to help with – it’s taken me all my willpower to persevere with Debian as a lifelong Windows user. Let’s see what I’m running here… on my main machine – I ahve node v 4.6.1, npm 2.15.9 and node-red 0.15.2

      On another I have node 7.2.0 and npm 4.0.3 – all work well with Node-Red-Contrib-Bigtimer which is currently running at version 1.4.7

      And as far as I can tell all is working.

      1. Ubuntu IS Debian – with loads of goodies added and repo’s that move a heck of a lot faster than the risk averse folks maintaining Debian like. But the base is Debian pretty much I think – certainly it used to be anyway.

        1. You may SAY that and you probably have more knowledge on the subject than I do – but as someone coming in fresh to Debian – and being familiar with the PI – and using Debian on other devices as you’ll see in the blog – I’ve come across several commands that seem to be standard in Debian that are simply not there for Ubuntu and there is no way my script runs under Ubuntu – one reason I’m sticking with Debian. I think you may find they’ve diverged a little.

        2. no, it WAS debian… they forked it way long time ago… the filesystem organization, the tools, are the same, but they differ a lot in management and many other things… ubuntu forces you to have good “systemistic” behaviour, as NOT do everything as root, but becoming it only when needed, using sudo… but many pure “penguins” thinks this “stinks”, and want full control…

          1. Fair enough. Though I’d say that Rasbian isn’t Debian either 😉

            In my own limited experience I’ve not found that much difference between Debian and Ubuntu Minimal when managing VPS’s for example. Not that I do a lot of that which may explain it. Perhaps I’m just used to Debian now but I don’t find any great problems with secure configurations on it vs Ubuntu.

            Anyway most of the scripts I’ve written work on both. But that certainly wouldn’t be true of a Rasbian script vs a VPS script. Rasbian is designed to be used by students and makers for IoT and not necessarily for anything secure. Of course, it also has to operate in a very constrained environment. So it is stripped down and simplified in many cases.

            Anyway, we are well off-topic now and should probably get off the airwaves.

            1. Agreed… simple is good – for many of us Linux is an inconvenient truth, not a hobby or job – it is merely a means to an end without using Microsoft – so the simpler the better 🙂

    2. Recall you need to be in your .node-red directory – not PI or whatever – and it is npm install node-red-contrib-bigtimer

      That should net you the latest version. Stop Node-Red and restart it

      1. I have installed Bigtimer from my .node-red directory. I have also run “npm update” from within the .node-red directory. It found the mysql node was out of date but nothing else. I deleted all instances of Bigtimer and deleted it from nod-red using the admin node. I reinstalled it using admin. Then I added a new Bigtimer node. It still looks like the old version. The package.json file in the node-red-contrib-bigtimer directory show the version is 1.4.6. I restarted node-red after each change and have rebooted for other reasons as well.

        Meanwhile I have a workaround to turn the lights off.

        Didn’t mean to start a Debian vs Ubuntu vs ??? discussion. I started with Ubuntu before Raspian came to be and have just stuck with it out of habit I guess. I do have a couple Raspberry Pies but none running node-red (yet).


        1. Hi John – leave bigtimer for tonight – conversation going on in SLACK – I added something for someone else -and it’s taking a couple of revisions – all should be great by the morning. Anyway there’s a new feature to come out of it all and possibly a bug-fix.

  46. hi Pete, after many months of working flawlessy of your BigTimer to control my garden lights I decide to upgrade it to the latest version…
    as a results the nodes I was using before become not working no matter what I tried 🙁 (wife was upset as all lights in the garden were off in the evening…!)
    I had to remove all of them and recreate all in NodeRed with same settings and they all seems to work now even thou every time I deploy I get an error for all of them “Node is not configured properly” and if I open any the field “topic” is red-highlighted…
    I never used topic and I have no needs of it, so is it normal this behaviour?

    1. It seems one can’t please everyone. Someone had the bright idea of insulting me because I don’t use proper verification on node inputs (probably someone who insists on CE marking).

      So, being a helpful type I added verification – and the red boxes you see are objecting to the lack of input.

      Clearly however this has opened up a can of worms. As you quite rightly say, for SOME requirements, topic may not actually be needed.

      My thinking for insisting on topic, of course, was based on the assumption of MQTT output which requires both topic and payload. So from that perspective, that is indeed “normal behaviour”.

      If you would care to check in about an hour, version 1.4.8 should be available – and you can now leave the topic blank.

      This however has left me with a discovery – that my knowledge of REGEX which was never startling, may be worse than I thought.

      outtopic: {value:””,validate:RED.validators.regex(/[a-zA-Z123_]*/) },

      What you see above should allow zero or more occurrences of any letter, upper or lower case, any number and optional underscores. In fact, I added an exclamation mark and it lets that through as well – hence kind of defeating the idea of having verification. If any bright REGEX spark looking in would care to tell me what is wrong there, I’ll update the next version with a corrected regex. But the short answer is – you have what you need – blank topics!

      1. Make that 1.4.81 – just had a word with the guys from Node-Red and my Regex was nonsense. Now it accepts A-Z, a-z, 0-9, slashes and underscores – or nothing. Give it an hour max to filter through.

  47. Oh dear, the life of an open source programmer is never easy Peter!

    Thanks for the continuing efforts.

    I sense that my next requests for enhancements should maybe wait until after Christmas 🙂

  48. Doh!

    I’ve updated but this time you’ve put some validation on the Name field that breaks things!

    I have names like: “F Hall (03) Jun-Aug On Sunset-1hrs -> 01:00” and I now get a not properly configured error that I can’t get rid of.

      1. Yes, well it all makes sense when you see them all lined up on a page 🙂

        I like to give things descriptive names and since Node-RED doesn’t allow descriptive text in its nodes, the Name field is the only place you can consistently do that.

        Point is that the name doesn’t really need any restrictions on it as it is only used by the Node-RED admin UI and the debug output.

        1. Ok, well I guess I did put it out there for others to benefit – accordingly – NAME no longer has checking – fire away (but give it half an hour to propagate). v1.4.84

  49. Hi Pete! (or anyone else reading this)

    I’m controlling a device using OpenHAB2. There’s a switch type item that sends a msg to a given topic (0 or 1) to turn it off or on. Now, since I have a couple of devices running using Bigtimer schedules, and if the device is already on, there’s no problem sending ON (1) from OH2, but if I send OFF (0), the device turns off (ESP subscribed to that topic) but it should return to “Bigtimer control” (scheduled). Any idea on how to implement this? TIA

  50. Hi Peter

    I’ve installed bigtimer on a new nodejs setup. I have one problem with it. seems to be not running properly when you set the off time to a ‘minutes’ value. for example: set start time to 19:00 and stop time to +10 minutes then deploy. you then get on for around 3h and 45 minutes. the system time is 19:00.

    all parameters have been left to their default original values.

    Any advice would be highly appreciated.


    1. Well, it looks like no-one including me actually has used that up to now – I’d never noticed it but I didn’t put the support code in for that. All fixed, give it maybe an hour and grab the updated version – you can just install as normal.

      1. Got the update. Thanks a lot

        What would it take to increase the resolution of the ‘start’ and ‘end time’ from a 15 minutes interval up to one minute? I presume it may be avoiding to load 1440 values into the combo boxes? if that it the case, may I suggest adding 2 text boxes just below he combo boxes. These 2 new text boxes will get their values from the combo boxes once the user makes a selection. The user may then edit the values in the text boxes to adjust the minute resolution.

        I have started to use the timer to automate things in three locations ( 2 town houses and an apartment)

        Many thanks for the hard work and the quick response… & Merry Xmas!

  51. I am in the UK and running big timer on node red on top of a DiskStation. I have what looks like a time zone problem.

    Basically the only way I can get to send the on/off messages at the correct times is to specify a UTC offset of 3 (three).
    Background: I only started playing with big timer yesterday and started with version V1.4.85. I just updated to V1.4.86 which also seems to have the same issue. The DiskStation kernel time is correct (UTC) and the DiskStation admin screen shows the correct time.
    I have tried deleting and recreate the big timer node after performing the upgrade since I am pretty sure that is required to load the new code.

    Anyway from what I have seen changing the UTC offset does not have the effect I would expect but perhaps I am miss-understanding the function.

    Also as a feature request could we specify the time offset as time zone name i.e. “BST” rather than a number since to cater for automatic daylight savings time.

    The attached image taken around 9:15pm shows the off time set for 11pm, the time left before the trigger (~1h 45m) and the UTC offset being set to 3 (when it should currently be set to 0)

    1. Erm, are you setting the correct longitude and latitude? Because I’m in the UK and not having any issues with timing at all.

      1. Don’t worry about this I did a simple “input->timestamp” to “debug output” and converted the epoch result manually.

        The result was node-red thinks the time is off by three hours.

        I probably should have undertaken a manual installation of node-red instead of using the synology package manager.

        1. Update:
          This must have been a synology problem. It was resolved when I re-enabled automatic NTP updates.

          I have no Idea why that feature was not enabled by default but I noticed the manual setting for the synology time was showing with the three hour offest (even thought it was set for the correct timezone).

          I guess the system control panel time was corrected by my browser correcting for its local timezone.

          Anyway resyncing with NTP fixed the issue.

          Sorry for the confusion.

  52. Hi Peter,

    Love your work. This is perfect for what I want to do. My only question is can we send text strings into BigTimer so we can adjust parameters, ie change start times, on days etc? Can we also have a setting to calculate the finish time based on a duration field? so we want to turn the timer on for 45 mins, on mon-wed at 8pm. Idead behind this is to setup drop down menus/buttons etc in a gui.

    Thanks for all your hard work!


    1. Hi – this is an old question – you can turn the unit into manual – and other features with an injected string – but not set the start and stop times as they would not survive power cycling. There is a duration field – I just updated that yesterday as there was a bug.

  53. Hi Peter!

    I’ve just started out with node red and big-timer is one of the first modules I’ve installed, I really appreciate your work behind this module.

    I’m trying to build a DIY irrigation controller, normally this is a very straightforward configuration and a direct use case for the bigtimer module where irrigation zones can be started and stopped at specific times. But I have a different set of requirement. I have a mqtt topic to inform about the water pump running status. Here in India irrigation pumps run erratic time schedules due to state electricity supply schedules, maintenance downtimes and breakdowns which is further complicated by water availability issues. We have dry run protection systems for times when the water runs out. Thus the pump only runs when both electric supply and water are available.

    As discussed in your previous posts, setting start times and stop times via an input is not possible for various reasons. So is it possible that a countdown timer functionality be added and the countdown timer be started, paused and resumed from an input? (just like on, off, auto and manual presently available) Thus making it possible to start countdown timers once the pump is up and running and pause them when the pump stops, resume again when the pump runs again and then automatically stop when countdown ends.

    In short i’m looking at running my irrigation zones 1 and 2 for 2 and 4 hours respectively one after the another per day. The pump usually runs a cumulative total of 8 hrs per day split into multiple unpredictable shifts throughout the day.

    The timers also need to reset at
    1. the end of the day (00.00 am) if they are paused/completed/not started at 00.00 am
    2. the first paused or completed event after the end of the day(00.00 am) (because pump can come on at 10 pm and run till 4 am the next morning. we don’t want the timer to reset in between)

    Countdown timers could be a generic requirement also IMO.


    1. Hi Indrajit,

      Did bigtimer work for you in indian time zone.
      i am having no success in doing so.

      Good to know you are working on irrigation solution.
      lets connect send ur contact details


      1. I’ve not tried using it in the Indian timezone but I’ve used it in Spain and the UK and there are users using it in the USA and elsewhere. A little more info would be nice.

  54. so If I’m wiring the 1st output into a function node where I want to check the value of that first output…what am I telling it to check for?

    msg.state===”on” or “off” OR msg.state===1 or 0 ?

  55. Hello Peter,
    First of all, thanks for ytour hard work, that makes our professional lives much easier.
    I was trying to install bigtimer node on my node-red installation. I followed all the different advices that you give in order to install it (under windows 8.1 and node-red v 0.15.2) The thing is that the module´s directory is actually created in /.node-red/node_modules; and when you go to “manage palette ” section you can see it as installed too. But whenever I run node-red I can see this message on the console:

    [bigtimer] SyntaxError: Invalid or unexpected token

    And Bigtimer is then nowhere to be found.
    Can you give me any hint on this issue?

    This happened with other modules like “Biglib”. By the way, I did manage to install scheduler and it worked ok.

    Best regards,


    1. There is indeed an illegal token in there and I have NO IDEA right now how that crept in. The “debugging” doesn’t exactly help as there is no more info. Working on it – but don’t expect miracles today – dentist appointment coming up soon. Anyone out there who wants to take a look – it has to be in one of the files bigtimer.js, bigtimer.hrml or package.json in the /home/pi/.node-red/node_modules/node-red-contrib-bigtimer folder…

      Annoying – the one time I wish I was doing versioning.

      1. GIT!

        Not you that is 😉 rather the git source control system, the heart also of GitHub.

        That does versioning for you and lets you do easy rollbacks and so on, integration with GitHub means much easier contributions from other people, issue tracking, documentation, etc. There are GUI clients for Windows and Linux if, like me, you can’t get your head around the arcane commands.

        1. arcane commands are nerd’s food 🙂
          ever seen a SINGLE hacker using a mouse in movies and tv shows? 🙂
          BTW, Peter uses bitbucket for his sources, so i think it should have github equivalent tools…

          p.s.: git was invented by Linus Torvalds, “inventor” of that other cool little thing called Linux 😉

  56. Hi Peter great work!
    I’d just like to get a sanity check opinion on the use of a couple of timers in a flow that sort of follows your ‘OR’ example. I have a heating system setup with a timer for the morning schedule and another timer for the evening schedule. What I’m doing is merging the output of the timer schedules into a single function which merges the state of both timers into a single output. I then shove this through a delay node to rate limit outbound mqtt messages.

    The innards of the merge function looks like this:

    context.earlystate = context.earlystate || “0”;
    context.latestate = context.latestate || “0”;

    if (msg.topic === ‘EarlySchedule’) {
    context.earlystate = msg.payload;
    if (msg.topic === ‘LateSchedule’) {
    context.latestate = msg.payload;

    var on = (context.earlystate == “1” || context.latestate == “1”);
    return {“topic”: “heatingState”, “payload”: on ? “1” : “0”};

    I’ve attached a screenshot of the flow.

    This seems to work fine but I’d like to ask if you think this is this the right way to go or am I completely mad with this arrangement?


    1. Looks great, I’m at a loss as to why so complicated however.. you seem to be checking the input basically for 1 and 0 – and accordingly returning one or 0 – why do you need anything in that function? I’m probably missing uses for that info elsewhere.

      1. Thanks, good question and well, that’s exactly the thing I’m seeking the sanity check on 🙂

        It’s probably not completely clear what’s going here from what I said previously so I’ll try and add a bit of clarity: the chunk of JS in my last post is the innards of the “StateMerge” function node that can be seen in the screenshot and what it’s doing it taking the resulting output messages from both BigTimers and merging them into a single message so that this single message can be used to send a single and consistent ‘one shot’ rate limited ON or OFF mqtt outbound message to control my heating system.

        If I don’t perform this post-timer “StateMerge” operation and attempt to feed the timer messages directly to mqtt (delay rate limited or not), I saw I can then potentially get two mqtt messages in very near proximity to each other when controlling/overriding the timers via the input on,off,auto override words..which I’ll say is completely expected and by-design behaviour of BigTimer.

        The thing here is that during testing, I found this type of setup can start to go wrong especially when controlling the override input messages to the BigTimers (on, off, auto etc) because one of the 2 outbound messages leaving the BigTimers always “wins” and the outcome of that win depends on the state of timers at that point in time (1st timer ON, 2nd OFF or vice versa).

        This unexpected side effect meant that I either saw a heating ON mqtt signal (1) followed by a heating OFF mqtt signal (0) or vice versa and this behaviour was non-deterministic and totally undesirable.

        The problem is completely solved via introduction of the merge and rate limit mechanism so there’s no problem at all really but I really just wanted to check if I was doing things right by handling/merging the output of 2 BigTimers in this way or if I’d missed a trick somewhere.

        Sorry for rambling on, I hope this makes sense


  57. For the BigTimer, how do you specify latt/long correctly?

    My home is at 40.1304° N, 75.5149° W. How do I specify N/S or E/W in the properties of the BigTimer? 40.1304° N, 75.5149° W is different from 40.1304° N, 75.5149° E or 40.1304° S, 75.5149° W or 40.1304° S, 75.5149° E.

    1. As often the case – VASTLY insufficient data to answer the question. what do you mean by “configure. If you can inject into the input – yes, you can fire stuff in from any node – if you mean set the start and stop times – no – you do that in the normal node setup.

  58. Sorry for the question, but super new to this. I am trying to accomplish the following:

    Based on SunriseHour > trigger lights to come on at a certain offset to sunrise. Example IF SunriseHour >= 7, at Sunrise+60, turn on X lights.

    Figured I’d accomplish this by:

    Injecting the global SunriseHour at say 4 am each day > to a switch node checking for payload value > into one of several BigTimers that will fire on the specified sunrise offset…..but seems that would be injecting a value of say “7” into BigTimer…which I cannot do, correct?

    Do I need to place another function in between the switch and BigTimer to basically say if the switch output is “7”, return “on”? Please let me know if I’m on the right track.

    1. As each timer can be programmed to know sunrise via the longitude and latitude I’m not sure why you’re not using that.

      1. well….if sunrisehour is 7 vs 5, I want to start my flow an hour prior to sunrise, otherwise if 5, I want it to start promptly at sunrise….the timer only gives me an output of 1 or 0 at the time specific in the timer…I thought?

        1. You can add an offset – that is one of the boxes and so several timers would all work differently – but not dynamically…

  59. I was disappointed to find the big-timer node not available in FRED. So after I made a request to have it added, I got a reply from sensetecnic this afternoon that it has been added. Now time to play!

  60. Hey Pete,

    First off, hats off to you for Big Timer and all the support you’ve provided this community! I scrolled through a bunch of the messages and came up with a whole bunch more use cases for this…

    Curious, is there a way to set a separate Topic Msg for off events? It’s not a show stopper as I think someone above used a function node to do something similar. But thought I’d throw this out to you.


    1. No but there’s a simple way to do it – simply take the payload, ignore the topic – and put any topic and payload into the payload, separated by a comma – then split them apart in a function block. Simples!

  61. Hi Peter, ive been playing with your bigtimer for my terrarium automation. Quick question. I have some devices that cant stay in manual for more than a minute. So I figured id set the timeout to 1. But this doesnt seem to work. It remains in manual mode. Or at least, the status claims it’s still in manual/off mode.

    Am I misunderstanding the timeout option?


    1. Hi there Cor.

      So two things – let’s say the timer is OFF all (auto) and you inject (ON) – the manual status will revert to auto on the next change of auto state – OR X minutes later if that X (timeout) is a sensible value. TWO things however, it was meant for longer periods – and 1 does not work at all well. Also the timing is based on real minutes, not a minute after you press the button – so for very short periods like 2 seconds – the actual period is highly variable – that is because I did not want the overhead of a timer checking every second. So consider the timeout valid for longer periods – 5 minutes or so.

      I could fix the “1” issue easily but would have to ponder what effect that might have on the many people using the timer right now.

      1. Hi Peter, I could probably work something out with a delay node or something and force it back into auto mode after 30s. These are things like misters which you dont want to run for very long.

        It’s actually quite complicated to do this stuff well and not kill your terrarium by accident. I have failsafes for every scenario I can think of. Things like a node-red reload during a delay node, and not receiving the off signal.

        Little bit off topic, but I just want to say I love your site. Tons of overlap with stuff im working on so that saves lots of time. Going to be programming a bunch of sonoffs soon.

  62. Hi Peter, I do like the node, but I am having a problem with the timeout. I changed the timeout to 2, and manually injected On. Bigtimer actioned the On command, and in NodeRed the message under the node showed “On Temp Override”. All good. After 2 mins, that status message changed to “Off Temp override”, but the node didn’t do anything else – it didn’t go back to auto status, and it didn’t execute the Off msg, nor the Off Text. This was before sunset, i.e during an Off period. I also tried it with a 10 minute timeout that did the same. Am I missing something in how the Timeout is supposed to work?

    1. Good afternoon Ian. I tried the timeout and you’re right – it doesn’t work correctly. Well spotted. Further, the SYNC function doesn’t – but as I neglected to document that, no-one knows about it. I have fixed this and have released version 1.5.0 which will appear sometime this afternoon – with some additional status output available in the first output msg.

      Manual operations will affect the timeout – so now you can use “sync” to quickly get through the timeout for testing. In the first output – if you look at the whole message, you’ll see msg.timeout so you can monitor it.

            1. Greetings Peter,
              I was struggling with the same thing as Ian so thanks. Now, I send the On command and the message under the node shows “On Temp Override”. After 3 mins (my timeout setting), the status message changes to “No action today” which is correct but the node didn’t send the Off msg. I am certain I have to be doing something wrong (or the node is not supposed to send the Off msg). Sorry to be so dense.

              1. The node is not supposed to send an off message because there is no action today. Let’s say you had an automatic setup and the current status was off. Then, if you manually set the node to ON and your timeout settings ran out then you would reasonably expect the node to default back to the off automatic setting and send and OFF signal.

                If there is no action today and you go to manual then you are on your own.

                Does that make sense.

                1. Thanks Pete – I was trying to use that feature for my sprinkler system which would allow me to manually trigger a 45 minute cycle on a zone. I thought the On command along with the timeout would work. I figured I was wrong about how to use that feature – thank you for confirming.

                  I solved the problem by adding a delay node which then fires a function to deliver “auto” to the bigtimer after that delay. Auto seems to trigger the “off” command.


                  1. If you are using my ESP8266 software, you can put a timeout on any command.. See manual for OUT X

                    It is something like (for, for example GPIO15) {out15,6,x} where x is how long you want the item to stay on.

  63. Hi Peter,

    in combination with your (great!) BigTimer I needed something to determine whether if its business day at that moment, if its holiday, which weekday it is, regarding energy consumption if its lower or higher tariff etc. So I wrote a function and decided to share it so anyone could use it for its own purposes. The code naturally includes our national (Slovenian) holiday sets. Ofcourse modificaitions are needed for use in any other country which has its own set of holidays and energy consumption tariff rules.

    Im using it in combination with BigTimer to turn on the light in the morning when its time to get up but only if its business day 🙂 I also pass messages to it from energy meter and then calculate energy consumption in kWh for lower and higher tariff. And water heater is turned off in higher tariff at 20:00 so water is not heated during showering time but gets heated when lower tariff kicks in at 22:00.
    I hope anyone else could benefit using this stuff. Im also open for suggestions and improvements!

    The code is under beerware license 🙂

  64. Peter, wonder about using the Bg Timer with my Wemo Light Switch. I’ve tried the Wemo nodes available, but they don’t recognize the switch. I can ping the switch without any problems and the switch does turn on and off as per the app on a cell phone. I’d like to try and get it under control with Node-RED, if possible.

    Big Timer looks to have everything covered as to how I’m looking after the switch now.

    Any suggestions?

    1. Hi – What you are trying to achieve is basically the opposite of what is covered in Namely where that talks about imitating a wemo switch and then redirecting messages meant for that switch, you need to discover the address of a real switch and then send messages to it. Belkin have deprecated their API but it is still a uPnP device so either of the following should work. If you want to go the native uPnP approach then should work alternatively you should be able to adapt the following solution into a node-red “node compatibilty” node.

      1. Thanks Steve, I don’t quite follow the Alexa post. II had previously read thru that and did not see how it applied to the light switch. As for the second link, I could not get the scripts to build, following the instructions on the Github.

        I just felt there might be a way to use the BigTimer to send a signal to an IP address to tell it to turn on and off. As stated, the actual WeMo nodes are not picking up my switch and seem to be used for the other WeMo products.

  65. Hi Peter,
    maybe it is something already discussed…. i was looking a way to configure Bigtimer via HMI, otherwise you always need to make changes at configuration level.

    have you already considered this?

      1. yes, of course,
        however as a UI user you may not have access to configuration page, (unless i miss something…) and difficult to create a different node for each case….

        you can create one timer for each main mode of operation, but assuming you need to change some configuration data, such as sunset offset you need to go back to configuration mode.
        i think that an IoT system should be fully manageable from UI


        1. Hi there. That is not what BigTimer is intended for. It is intended that you will set the times in the configuration page – and either leave it to run automatically or inject manual override commands.

          However as loading the timer also loads the source, you are welcome to make a different version.

          Making a simple ui controlled timers in a Node-Red function would let you do what you want.

    1. You may now set up manual override of on-off times – see the info panel on the latest version of node-red-contrib-bigtimer.

    1. Yes you may ask, Joe 🙂

      No I don’t. When you grab BigTimer, you have a copy of the source. For me, putting it on Bitbucket is just another layer of un-necessary work. If I find a fault – or someone else does, I take my local version in Node-Red – which is always the latest…. I fix the problem on my live Node-Red installation – and publish it. All very simple to do.

      1. Fair enough no problem. There would be a couple of potential advantages for comsumers of this if it were on bitbucket/github and a possible advantage for the code in this project too..but yeah I get I can look at and modify the code locally if I want to.

  66. Hi Peter, I realise this is a bit of an edge case, but is there a way to tell the timer to be on permanently? I tried saying 00:00 for both on and off but that didnt quite work as I hoped. Basically I wanted to turn off any timer functionality (temporarily) while still retaining the option to manually turn things on and off through the input. If I turn off the schedule, the timer doesnt pass any messages through it seems.

    1. You’re right – the way I implemented turning the schedule, I do it by simply putting a condition around the outputs – so the calcs are done but nothing goes out. I’d have to think about how to do that – lets see if anyone else comes up with a similar requirement…

  67. I’ve been trying to set up two timers in an OR configuration so that when one timer is active, the other big timer is OFF. I set up two timers with a mode switch but it only locks out the second big timer for one cycle. I am using a dropdown menu to select which big timer I want to be active. I have a “switch” function and a “change” function to send the OFF command to the second timer when the first one gets an AUTO command, and vice-versa. Is there a way to lock it out indefinitely?

    I don’t know how to post my node-red flow diagram.

    1. If you look back through the comments, someone asked this a while ago – and I seem to recall making a change so that if there was no output message, nothing was sent – hence you could OR them.

  68. Hi Peter,
    thanks for providing this timer.
    I use v.1.5.1, I cannot seem to figure out what the special dates do.
    My UC is: I want the timer to ping every Friday at noon (works presumeably, as it worked when testing for tuesday). And furthermore I want it to ping on the last day of each month. To achieve that, I tried the special dates, entered day 28, month 2 for today. no action 🙁 am I misunderstanding the concept?

    1. Special dates… well, special days of the year, as it says on the can – day and month so set the day to 25, month to 1 and things will happen on Xmas day

      Special weekdays – day and week – so 1, 2 means the first day of the second week of the month.

    2. A good example might be today. Set the timer for most of the day including now – but untick February – you’ll find the timer says no action today..

      But make the exception – “special weekdays of the month” – day 3, week 4. That’s today…. and lo – the timer operates… OR (set those back to 0) – select the 28th day of the second month – that’s today – and again – the timer operates…

      1. thanks for the quick response ? awesome.
        It is very cool, and I am using the node already for the fridays task.

        Looks like I did not misunderstand the special concept then.
        I attach a screenshot for your reference of my config. It appears to be no action today, even though it is feb 28.
        I tried it also with a second bigtimer node that /only/ has the special dates, but it did not show action either. Is it maybe a bit buggy, or am I still misunderstanding. Thanks for your support.

    1. Stunning- there’s a bug! If you turn off the DAYS, then the special days will not work. How no-one has spotted this up to now – including me… anyway, 1.5.2 will be released later today with this fixed and some minor amendments to descriptions. Well done.

  69. I’ve been playing with BigTimer, and love it.
    I do have a question, though.
    Is Output 2 payload not tied to the ON/Off state of the other 2 outputs?
    It looks like it can’t be overridden by the manual input.
    From the code, I see it set as follows:
    outmsg2.payload = (autoState==1)? “1” : “0”;
    Am I misunderstanding the purpose of Output 2?


    1. No Brent, you are understanding it absolutely perfectly.

      Let me just say… version 1.5.4 was released moments ago


      It also has a few more useful outputs, for good measure.

  70. A small issue perhaps, what’s the reasoning for allowing BIGTIMER to respond to On and OFF inputs when its in the AUTO state? My experience is that, while BIGTIMER is AUTO and ON, an OFF input will make the output of BIGTIMER go to OFF until the current per-minute timer expires. Seems to me that if it’s in AUTO mode it should simply follow its schedule. What say you?

    1. No. The purpose of on and off is for override. You may for example have the lights scheduled to go off at midnight and wish to override that. The lights will then go off and at midnight or when the timer runs out – whichever is first, the lights will revert to auto. Similarly you may choose to manually put the lights on earlier than schedule.

  71. if an off override is automatically reset back to regular automated schedule at some point, would I be right to assume that the “Suspend schedule” feature is more strict than this and it remains off / suspended indefinitely..until node red is restarted at least?

    I’m sort of coming from the angle of where it would be quite nice to have the ability to hard override the timer to off for long periods of time.

    1. Correct – suspend will stay that way until Node-Red is restarted. There are also two ways to handle on and off. If you select “manual” then off” – the off (or on) period is determined by the timeout – which you can of course set – but will NOT be reset by change of auto state – so you have the best of both worlds.

      1. On reflection and a little bit of testing, I think the best way for me to get the long term timer off behaviour that I’m after will be to use the “stop” input value. I believe it does what I need – it’s the implementation of a complete and long term persistent switch off of all timer features with absolutely no automatic re-enablement..which can later be switched back with an “auto” or “on” override input value.

  72. Noted your intentions wrt behaviour of on and off in auto mode, and quite understand your intentions EXCEPT when the repeat thingy is enabled. It’s going to try it’s damnedest to assert the scheduled setting no matter someone’s intention to do otherwise. To follow your reasoning, perhaps it should honour the ON or OFF command and keep repeating the new setting until the next change in schedule – if that makes sense. Kind regards.

    1. And I understand your logic Peter – however I am sitting here with a BigTimer for my office light set to come on only in the evening, but having gotten up early I need it on so I can do my emails – the repeat “thingy” is selected, this is a valid day for the timer which otherwise would read “Auto Off”, I am on manual override and the light is not flickering! Are you using an up to date BigTimer? Let me know if you can repeatedly demonstrate a contradiction to this?

  73. Awesome work Peter! I love it. I’m curious how does the node calculate the sunset and sunrise times in function of the coordinates. Does it pull these times from a specific website or did you make some sort of calculation of your own to calculate these times?

    1. The calculations come from the one dependency that Node-Red has – an imported Javascript function – so the short answer is no, I didn’t do the calcs for that.

  74. Hello Peter
    Thanks for the great plugin and blogs.

    I would like to switch on lights at sunrise or night end, a value that changes. But I want to switch off at a fixed time, so say 7:00AM. Most of the year that works but there will be a moment where the sunrise is after 7:00 so the light will stay on all day.
    Is it possible to do this with your plugin somehow?


    1. Hi there Rik

      To clarify – technically BigTimer is a NODE for Node-Red. Can I assume you meant “sunset or night end” ?? I can’t imagine wanting to switch on lights when it gets lighter?? With BigTimer you can switch lights on at a fixed time or at sunset or a couple of variations on that- and back off at a fixed time or sunrise etc… Not sure if that answers the question or if I’m missing the point.

  75. Sorry that wasn’t clear. I want to switch on at 6:00 and switch off at sunrise.
    The point is that for a part of the year the sunrise is after 6:00 and for the other part it is before.
    I only want to switch on the lights at 6:00, if the sunrise is after 6:00 (otherwise it is light enough). So if the sunrise is before 6:00 the lights shouldn’t switch on at all.
    I hope now it is more clear.

    1. Ah, so 6am and then off at sunrise… well, that’s a new one… let me see if sunrise is before 6am…. they’ll switch off even though they are not on.. and switch on at 6am and hence stay on all day.

      I have implemented a check for the off time being before the on time – meant to handle on at 10pm, off a 2am but I can’t get my head around whether this will solve your problem.

      Only one way to find out – experiment! Do let us know.

      1. Yes, I did some experiments already. But that didn’t use the sunrise statement (that would take so long to test) but used an ON time later than an OFF time. And then I see what you described. I will test the sunrise statement though.
        Could you perhaps make a setting for this? E.g. a checkbox ‘same day’ that will not check the 10 pm – 2am situation you describe?

        1. So I’ve tested it and the good news is, it was as expected. So it switches off at 6AM and switches back on at 6:49 (sunrise).
          I’ve thought of another way to overcome this. If the node sends the on and off time in its msg, I can check with a function block if the on time is after the off time, and then don’t switch to on.
          Hope you can help here.

          1. Rik

            The centre output of the node…. if you look at msg.start and msg.end you’ll find they are the start and stop times in minutes past midnight – with that you should be able to get what you need. To play with this try putting debug nodes (showing the whole object not just the payload) on the outputs and fire, say “ON” commands into the input to trigger output. There is lots of info there for you.

            1. Thank you again. It appears I was using an old version as the one I had didn’t have this info in the centre output. So this will help.

              Thanks for the support and keep on the nice blogs!

  76. Hi Pete,

    I was getting an error with Big Timer on a couple of overrides because they were coming in as integer 0 and 1 rather than string “0” and “1” and this upsets the toLowerCase function.

    To deal with this for all current and future happenings, I changed line 354 in Big Timer by adding .tostring():

    var theSwitch = inmsg.payload.toString().toLowerCase().split(” “);

    This stops integer inputs throwing an error.

    1. Um, OK, that ‘fix’ borks on zeros! Plan B – force payload to be a string by adding the following line above the start of the override processing section – note, that’s two single quotes and not a double quote:

      // manual override
      inmsg.payload = inmsg.payload+”; // Force payload to be a string
      if (inmsg.payload > “”) {
      var theSwitch = inmsg.payload.toLowerCase().split(” “);

      1. All good except for the line number – it is 346 on mine – you sure you’re using the latest version?? V4.6.1 ??

          1. Good morning Linker3000

            Sorry – yes that is correct… which makes it all the more odd that (although I know what you are getting at) you changed line 357 when the actual line is 346 on my original.

            I have never come across this problem before – however your modification makes perfect sense.




  77. Pete,
    I love your BigTimer. I’m using in a node-red controlled hydroponics lab to control various things like fans, pumps, etc. It works great but I can’t seem to figure out how to make a timer come on for 5 minutes (or whatever) then off for 55 minutes and repeat this forever. Is there a way.

    1. Easy Bruce – don’t use BigTimer for that. Set an INJECT node to send something every HOUR – and use my TIMEOUT node on the output of that.

  78. Hi, thank you for awesome timer! I use 1.5.7 version. I have got three bigtimers so I can cover whole week with different settings for various days. Outputs are connected together and I’m receiving sequence of “on” and “off” instead of one message. How can I set the timers which are not “on” to not override with “off” message – to sent empty messages please? Thank you!

    1. Well, I went off and did some tests – and sure enough – on a day when the timer is not active – it keeps sending OFF signals… well, rather, it did.

      Now, after all that, I’ve a little problem that right now it has DISAPPEARED from the node-red flows site – I’ve asked the question – however it is here..

      Keep an eye out for version 6 appearing where it should be, soon. This should meet your needs – please (and anyone reading this) do test and let me know.

      1. Problem solved, new version working fine! Thank you very much for express update! much appreciate.

  79. I have a five function node that send a message (SMS and e-post) to me if a temperature is going high or low. My question is if it’s possible to send the message to difrent e-post an SMS depenig of what mounth it is. Have tryed the Big-Timmer with no luck. Maybe have to do this in the function node.

    Please any solution will be great


    1. It’s “bigtimer” (node-red-contrib-bigtimer). I don’t see what would be hard about doing the whole thing in a simple function node. I’ve never sent an SMS – as most of the free Gateways are in America where most of us are not. I use emails – and triggering an email based on month is easy.

      So for example in the function node you might put..

      var now=new Date();
      var fred=now.getMonth();

      That should give you the current month – and the rest is easy. BUT BEWARE, if the month is MAY – this will return 4 – because months come back 0-11 for reasons that escape me.

      So – you have your input (msg.payload) and you have your month…..

  80. hi. Im having some issues getting the override to work properly. I’m using your node so that ‘on’ will trigger an event during the day, and ‘off’ will reset the values at midnight so the event can happen again next day. Also I’m using a dashboard where you can manually set the time for the event. However the node wont always set the time I input. It seems it depends upon whether the node is on/off and whether the time of day inserted had already passed, but I can’t really understand it.

    1. So firstly – which version are you using – this is important as I updated the node just a couple of days ago.

    2. When you say “set the time you input” – are you manually inserting time, are you setting it up on the dialog box, what time, under what circumstances… if you give me an exact example of it not doing what you expect- and tell me what you are seeing as against what you expect, then I can replicate your setup to discover if there is an issue.

  81. intput 2: outputs a 1 or 0 every minute when checking (in msg.payload) – you can use that to light up something.

    I can change this value. i need to change 10 sec for information

  82. BigTimer – Sync?

    Hi Pete

    I need to implement a ‘toggle’ function, reversing the current state of a Sonoff that is ultimately under the control of BigTimer.

    Currently, I can add an inject node (with the message of “toggle”) on the input of the MQTT Output node and handle it within the code of the Sonoff, but it would be much cleaner if I could toggle the current state of BigTimer – is this what the ‘sync’ input command is about, I couldn’t find out much about ‘sync’.

    Obviously, the inject node is just for testing purposes and would be replaced by something coming in from the real world as an MQTT post from the Sonoff – the idea being to use a Sonoff Touch.

    1. Simple put your own function before the input….
      If you say, for the sake of argument “toggle” – use a variable to toggle between sending “on” or “off” – anything else you just pass through – simples.

  83. if (msg.payload!=”toggle”) return msg;
    if (context.get(“toggler”)===0)
    { context.set(“toggler”,1); msg.payload=”on”; }
    { context.set(“toggler”,0); msg.payload=”off”; }
    return msg;

    1. Thanks for the function.

      Unfortunately, this is unaware of the current auto-state of the timer, since it only caches the state of the manual toggel trigger. It would be much better if I could just send “toggel” to the timer…

    1. Thanks Pete, that’s pretty much what I did, though my function is a lot less elegant (I’m a hardware man).

      if(msg.payload === “toggle”)
      msg.payload = global.get(“lastHallState”);
      if(msg.payload === false)
      global.set(“lastHallState”, true);
      global.set(“lastHallState”, false);
      if(global.get(“lastHallState”)=== true)
      msg.payload = “off”
      msg.payload = “on”
      return msg;

      I realise that the method takes two looks at the global variable and that’s probably unnecessary, but it seems to work.

      I’m still confused about the Sync input on BigTimer – what exactly does it do? I will probably never need it, but stranger things have happened.

  84. Apologies if this is made explicit elsewhere but I looked and couldn’t find it. I was injecting a zero into the timer to turn status to off and it was being ignored. The problem I eventually discovered was that it has to be formatted as a string from the inject node. I only discovered it when I tried a 1 and found that as a number it threw a TypeError but zero must be parsed as a space and therefore does not trigger any error message. Not sure if this can/needs to be addressed in the timer or perhaps a note in the instructions.

  85. Please note all – updated to Node-Red Timer – I’ve updated to work with latest Node-Red and also added a new seconds timer which I think you’ll like…

    So inject “timer 10” and the output will switch to manual ON for 10 seconds – then revert back to auto after 10 secs – rather handy for watering systems…

  86. Just to let you know npm update is not updating past version 1.6.2 for me. It shows the latest version as 1.6.7 which I can obtain by doing an install but npm outdated consistently shows the wanted version as 1.6.2. I’m on npm 3.10.10 and latest version of node-red. I’m not sure if its dependencies in the package.json but everything else updates ok.

    1. I just took a NEO2 which I’d installed just after an aborted update for the timer – so I had to update it..

      I stopped Node-Red and went into my .node-red directory (important) and did (as user PI)…

      npm install node-red-contrib-bigtimer

      I restarted Node-Red and there was the brand new version.

      I ran “npn outdated” and as I expected – nothing showed up – indicating that my installation is fully up to date.

      I hope this is helpful.

      1. just in case, this is the script i run to update EVERYTHING…

        it updates the packages from apt, then cleans all the caches and removes the unused packages (using deborphan for a more accurate and complete removal), then it cleans the npm caches, updates node-red and at last it updates every installed npm in ~/.node-red and rebuilds the packages… all unattended, just download, save as and run as user pi with “bash”

        1. Many thanks for this little script. Simple but effective! However it is not completely unattended. There was one question to be answered. If a log is running along this script I could tell you what it was exactly. Then there still is this thing about wanted/latest versions of node modules, they have not been updated! Big-timer is still 1.6.2. I suppose this must be updated by specifying the version when using the update command. Any idea how to avoid this behavior?

          1. i removed the output suppression switches, so if you rerun now this version, you should see where it halts asking for something… and i added the npm outdated command at the end so you can see if some node is still old… let me know which one, in case you can just use “npm install” with the node name to force reinstall of latest version…


            1. It is not so simple! Second time the script runned unattended. I was not sitting in front of the terminal all the time, but in the beginning I have seen some errors of deprecated packages(i probably don’t use them).
              This I found in my pi directory, most probably from the first run(because of time stamp). It is in the file npm-debug.log
              Second time npm update with root privileges npm did an update of all modules. I have seen this before and I found out I have an issue with my pi account. I think I do not have root rights. As I am a non linux user it is quite a study to find out why this is. I cannot remotely access my pi3 with WINSCP and that is is not a good sign and very inconvenient.

              1. nothing in that script about root rights… all npm packages are to be installed as user PI in ~/.node-red folder , the only exception is node-red and it has a dedicated line with sudo…

          2. Hi Leo

            What was the question – there should be no questions except at the start and end of the script.

            Latest versions- I’ve given up on the outdated function – it seems to depend on a file in the Node-Red folder which I’ve never gotten to grips with.

            If you move to your .node-red folder and apt-get install node-red-contrib-bigtimer you will get the latest version available… currently 1.6.7

            1. If you look at the node-red documentation it says the nodes will be updated to the latest version. They don’t, at least it does this is on my system (I have an issue with permissions).
              Cannot connect to it with FTP.
              npm outdated is also strange, it tells me one-time I need to update by presenting a list where the are a number of nodes not to the latest version, next time there comes no list at all. However there has not been any update in the mean time.

            2. no, he’s talking about my full update script, not yours 🙂
              i think the only question it can make is for password for sudo, if his user is not in sudoers file… other than that, all the remaing are just standard commands everybody does when updating, 1 by 1…

              1. I investigated in this… Systemd doesn’t start the script in /etc/init.d correctly.

                sudo nano /etc/systemd/system/mosquitto
                Insert following:
                Description=Mosquitto MQTT Broker daemon

                ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d
                ExecReload=/bin/kill -HUP $MAINPID


                To enable the script in systemd:
                sudo systemctl enable mosquitto

                After a reboot you can check with:
                sudo service mosquitto status

                1. That is working now! Many many thanks for this. I already noticed in webmin that this service was not srted at bootup, now with this addition the status has changed and confirms mosquitto starts at bootup. One down but still a few to go for a solid home automation server fully unattended at any circumstance.
                  Should Peter do some work in his script?

                2. updated script sent to Peter right now… if mosquitto is installed, in that if i added this, too

                  if [[ $OPSYS == *”RASPBIAN”* ]]; then
                  echo -e “[Unit]\n\
                  Description=Mosquitto MQTT Broker daemon\n\
                  ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d\n\
                  ExecReload=/bin/kill -HUP $MAINPID\n\
        \n” | sudo tee /lib/systemd/system/mosquitto
                  sudo systemctl start mosquitto 2>&1 | tee -a $LOGFILE
                  sudo systemctl enable mosquitto 2>&1 | tee -a $LOGFILE

      2. That is what I ended up doing but when I ran outdated before that it refused to upgrade beyond 1.6.2 just kept saying current 1.6,2, wanted 1.6.2, latest 1.6.7 and then update would ignore it. The documentation says that it may be something in the package.json but I don’t have one in that directory and all other modules upgrade OK. As you say no big thing its just a matter of doing an install and not relying on update

  87. Peter,

    I’m a beginner when it comes to using Node-Red. Is there a way to search or approach your posts archive that provides a logical training path for someone starting out on Node-Red ?

    1. Hi Roy – the short answer to that is no. The Node-Red site has good info however… I learned by “playing”. In the .node-red directory you’ll find flows*.json files – back those up and if you screw up – stop node-red – overwrite – start and you’re back in action – so don’t be afraid to experiment.

  88. First off I want to say I’m new to node-red and I want to say this Big Timer is an awesome feature.

    Is there a way for this timer to work on ODD or EVEN days?

    1. Sure – just select every other day near the bottom though you will clearly get one pair of adjacent days a week.

      1. I’m trying to setup a timer for my lawn irrigation.
        In my town we are supposed to water according to our house numbers.
        If my house number is even then I can water only on even numbered days.
        If our house number is odd then we can water on odd numbered days.
        Just thought this feature could be added in the future.

        1. Hmm, let’s think about this – can’t be day of the week because the start and end are both odd. Can’t be day of the month because on months with 31 days the start and end are the same… so it would I assume be day of the year – but then the start and end of the YEAR are odd.

          Care to elaborate? 🙂

          1. Not sure if your understanding
            I’m an even numbered house
            So I can water the 2,4,6, etc
            Day of each month. I do know that the odd numbered houses may get extra water days certain months of the year but I can only water on the even numbered days.

            1. Hi there David – yes I understood – I was just looking for clarification as to what constituted an “even” day. That you have provided and if you wait an hour or so for it to filter through, you will find version 1.6.8 contains two checkboxes to BAN output on odd and/or even days.

              Hopefully that will do the trick.

              1. Thanks you very very much.
                This is perfect.
                Yeah in our town this is the regulations we have so we can
                reduce water waste and allow everyone proper pressures on
                our streets.
                Thanks again.

              2. I just updated to 1.6.8 and cannot find the BAN ODD/EVEN checkboxes. They are not in the UI and not in info!
                Btw during my search I found this interesting feature: You can put info on the output pins of a node. By clicking on the output pin it changes to orange and the information field shows accordingly. I however cannot find any node with this specific information.

                1. Hi there

                  So two things:

                  Firstly the checkboxes ARE in 1.6.8 – near the end. I’ve just updated an old installation to test that.

                  cd .node-red
                  npm install node-red-contrib-bigtimer

                  Secondly you need look no further than node-red-contrib-bigtimer for the information on both the input and output pins. The instant this facility was made available I updated bigtimer.

                  1. I did not stopped and started node-red.I have the latest version of bigtimer. I will look later to it.

  89. hi,

    i tried big timer on my RsPi and now again on aws ec2 instance.
    it did not turn on at 17:30 and it stayed off through out.

    how do i know if the big timer is set to indian time after giving the lat long ?

    pfa the image.

    1. longitude and latitude set only the dusk and dawn times – your server time is used for the actual time and date.

      1. should i set the longitude and latitude to zero or leave it blank ?

        i want to set a custom time on and time off.

        i even tried using on_override and off_override it did not work

        the time on debug is correct which is the server time.

        Only timer 10 works i get a on time of 10 seconds.

        1. Set the longitude and latitude to YOUR longitude and latitude as you would find on Google maps command line when looking at your location.

          I tried timer 1, timer 3, timer 10 and timer 30 – all work accurately.

          1. It is quite clear – you HAVE to put in your longitude and latitude. Make sure your server time is set correctly.

            I’m not sure what you are trying to do here so can’t comment on whether it should be right or not. You seem to have offsets of 43 and 48 minutes on the on and off times…. Also you’ve set the on and off times the same.

            Try setting the off timer 30 minutes later and adding a negative offset if that’s what you want.

            1. When I say server – I mean of course the server that Node-Red is running on. Also I set my time to 11am and 11am – added 0 offset to the start, 3 offset to the end and sure enough it came on at 11am and went off 3 minutes later.

  90. Hi Peter,
    Just getting started in the home automation venture and am using Node Red with eight of your Big Timers. This is working Great! Got the latest BT with the “timer X” command where X is the number of seconds the output will stay ON. This is working fine. What would it take to add the command “timer Y” where Y is the number of minutes the output will stay ON? Saw your previous post about setting the on time & off time the same and adding 0 offset to the start & 3 offset to the off but I don’t want to change the original on/off times or offsets. The new “timer X” command works GREAT, and I think a “timer Y” addition would be useful with the benefit of not requiring the more frequent 1 second checking. Or is there another way to do this? Thanks again for your great contributions & blog.

  91. Hi,

    I am not sure what I am missing, but the all the times are wrong for sunset, sunrise, etc.

    I have set the Long & Lat. ( -27.4 , 151.9 ).

    start: 536
    end: 1320
    dusk: 551
    dawn: 1128
    solarNoon: 119
    sunrise: 1153
    sunset: 526
    night: 614
    nightEnd: 1065
    now: 1425

    Any Ideas?

        1. We are within 20km of that.
          Timezone is +10 GMT.
          The timer works great when using the just time, but the extra stuff needing the lat and long just don’t line up right. It looks totally inverted.
          Injecting a timestamp has epoch time as 1501016981699.
          ( GMT: Tuesday, 25 July 2017 21:09:41.699
          Your time zone: Wednesday, 26 July 2017 07:09:41.699 GMT+10:00)
          Running date on the server has it at “Tue Jul 25 21:11:46 UTC 2017”

          1. You might want to try a slightly different set of coordinates and compensate – no-one has come up with this before so I can’t help.

  92. Hi, very enjoyable blog. My goal is to set up bigtimer to control lights with a weekly schedule, say Monday 9am to 5pm, Tuesday, 9 am to 9pm, etc. etc. but it doesn’t appear bigtimer has that functionality.
    So, I started small trying to get it to turn on the lights at 45 minuted before dusk and off at 10pm. I have “On Time” as Dusk, 22:00 as off time. On offset is “-45”. Latitude as 43.878372, Longitude as -79.16159 which is correct. Real dusk is at about 8:30pm, near Toronto, Canada.
    I made the flow at 1:30pm, and it turned on immediately. It says “On for 04hrs, 32mins” which clearly is wrong. The machine time is right and “Man UTC” is 0. In the bottom of the info windoe for bigtimer, all days and months are checked, Repeat Output and Output at Startup is on, basically default settings. Any idea what I’m doing wrong ?

    1. Hi there – short answer – no – because I can only check my own two timezones – UK and Spain. Bear in mind that Node-Red is getting it’s time from your server – i.e. the place Node-Red is running – so that’s the first thing – and BigTimer has one dependency – a Javascript library that gives it the worldwide offsets. Looking forward to your further investigation with a view to seeing whether or not there are any issues with the JS library.

      1. Thank you. Yes, my mistake, it was the timezone on the raspberry pi that was not set right. Any thoughts about how to go about implementing a weekly schedule like for example, say Monday 9am to 5pm, Tuesday, 9 am to 9pm ? Any other nodes that may be better suited ?

  93. Thank you very much for creating this timer! It is extremely useful and should be a default node installed with node red.

    Working with the timer, I noticed that the override “off” with 0 or 1 have to be a string and not be a numeric number for it to set the override correctly. For example;

    Regardless of what the current auto state is of the timer:
    I can send an on override numeric or string of “1” and it will turn ON. If I send a numeric of “0”, it will NOT turn off.

    The only way for it to override off is it a STRING of “0” then it will override to off.

    I didn’t figure this out for at least a couple of hours. So hopefully this will help someone else out. Or if you can correct it for the next update please let me know. Or if you can change this description:

    “The input can be used as an override by simply sending a text or numeric message.”

    to read “The input can be used as an override by simply sending a STRING message.”

    that would fix it.


  94. I really appreciate the hard work put into this very effective node.

    I’m trying to set the “On Time” and “Off Time” from a dashboard, but can’t seem to get the on_override and off_override to change the On/Off Times. I’ve gotten the On, Off and Auto to work fine.

    Can you give me an example of the string that should be used to set the On Time for say 02:45 and Off Time for 10:30?

    1. Ok, updated – probably will appear in the next hour – 1.7.3

      So now if you use the on_override you should see the effects of your changes immediately – and the little DOT under the node should turn into a RING. You can also use a colon in the time..

      For example:

      on_override 17:45

      use on_override on it’s own or with -1 to go back to default settings… (similarly off_override)


  95. Thanks Peter – I’m testing it now and it appears to be accepting my on_override & off_override, but the calculation and On/Off time does not seem quite right. See attached pic, I sent it an “on_override 09:30” and “off_override 10:30” and it says it will be OFF for 57 minutes (server time was 09:33).

    1. That’s what I get for rushing – next release available in an hour max… I’d replicated the new on_override settings and missed one of variable settings for off. Should be fine now.

    1. Actually, just as I was saying that I realised I could simply move the override block to above the special settings. See the definition of manual override here in this blog entry – you can indeed specify dusk and dawn as special numbers – but you’ll need to do another update – 1.7.5 – same again – stop and start Node-Red after you update ( or stop – update – start as you prefer).

      Have fun.

  96. Hi Pete,
    many thanks for contributing this very useful timer node! Much appreciated.

    I might have a little suggestion for a minor but in my opinion useful improvement.
    As far as I understand it, we can currently set the ON message to be repeated automatically. However I have a couple of use-cases where this behavior would also be very advantageous for the OFF message.
    So my suggestion would be to have an independent checkbox for the repetition of the ON and OFF message.
    Could be something for a future version.
    Cheers Frank

    1. Ups, I just realized that ON and OFF msgs are actually repeated. A mistake in my ESP code.
      Sorry for that, I obviously should use the debug node a bit more.
      However,an independent control option might still be a useful add-on.

  97. Hi Pete,

    Thanks so much for not only Bigtimer, but also your blog & other contributions to the HA community!

    I’m a total n00b at node red/js, and your blog has been incredibly helpful so far 🙂

    Got two small Bigtimer questions for you –

    1) I noticed that you implemented “solarNoon” (visible in second output node messages), but haven’t exposed it as a time that can be used (as opposed to Dawn, Dusk, etc). It would be really great if this could be included in the time dropdowns! Any particular reason it’s not there yet?

    2) I’m trying to implement a “latest of two times / not before” logic — ie “on at dawn + 1 hr, or 07:00, whichever is latest”. I’ve come up with a number of nodered rube-goldberg contraptions, but nothing which feels particularly elegant. Do you have any hints on a good way to do this – or would you be interested in implementing that directly in Big Timer?

    Thanks again!!

    1. Thanks for the kind words. Well, it turns out I DID implement Solar Noon but simply left it off the menu. Accordingly, by the time you read this, version 1.7.7 of Bigtimer will be available with this feature included.

      As for latest of two times, I’m sure if you feed the output of two Bigtimers into a function you can some up with some mechanism…. I’ll leave you to ponder that one.



  98. Awesome, working like a charm 🙂

    Are you thinking in add some dashboard inputs? It would be nice if the user can set ON time/OFF time and the other specs by inserting the parameters in a interactive way.
    Im trying to build a irrigation scheduler, to turn on and off some zones, but every time i want to change the times i need to edit de BigTimer node by hand.

    Cheers and keep the good work Mr. Peter Scargill 🙂

    1. On and off times can be over-ridden by injecting text into the input – therefore using tools such as Node-Red-Dashboard you could add any level of interactivity you wanted….

      1. Can you give some example?
        Like: i want to turn on my sprinklers everyday from 22:00 to 22:15, my problem is, how to set this time without editing directly the BigTimer node.

        Best regards.

        1. Hi again Mr. Pete,

          I solved the on/off override by using the dropdown from dashboard, but now im facing another problem:

          For example:
          On Time: 22:30 | Off Time: 22:45

          on_override 10:30 | off_override: 10:45

          The override works well, but when the off_override finish, it will be back on at 22:30, and i dont want that happen, i wish to set the time to On at 10:30 every day and off at 10:45.


            1. Thanks for the fast reply Mr. Peter.

              Well, im confused now. I read the last paragraph, and i already understand how overrite on and off. But i dont understand how make it permanent.

              When manual overrite time it’s over, theBigTimer return back to is default On/Off specs, because its not possible to put them no “none” for example. Im not understanding if its possible to ignore forever the default specs, and if it is how?

              In this scheduler inspired by yours: node-red-contrib-schedex,

              It’s possible to set the on_time and off_time manualy because its possible to remove the predifined specs.

              Sorry for so many questions

              1. It isn’t permanent and I think I made that clear. To make such overrides permanent you need to store the results somewhere in a database complete with unique ID for each instance of the timer – and that’s another level. As the source is included with the project of course – anyone is welcome to make a custom version for themselves and hopefully share that back.

                1. There is of course a relatively simple way which you can do yourself. use an inject mode set to run only at startup – there’s a tickbox for that. Get the information for a specific timer and inject that data to the timer – so effectively that info becomes permanent – you can of course get the info from any database or file store of your choice. If you have multiple timers then of course you can set that function to have several outputs – or simply feed the injection node to several functions, each feeding a specific timer.


  99. Hi Peter,

    May you please help me workout what I am doing wrong?

    I want to use your timer with the “timer Xseconds” input.

    I have a flow setup that triggers the right text for the input but I can’t get anything on any of the 3 outputs using a debug output..

    I have got the suspend schedule ticked as I don’t want the schedule to trigger anything. Any thoughts? I have the text message for on and off set and the MQTT topic and payloads set.

    1. No idea what I was doing wrong.. But it works now., I have put an inject in the switch it off at startup and the use the timer X feature to switch on and off after that 🙂

  100. Hi Peter. I have my first BT working many thanks for that. How do we know that we have the latest version installed?

    Also i have been trying to get the TASMOTA nodes installed into Node-Red but have failed at every attempt. Are you able to point me in the right direction.

    I been using NPM i think it was and bricked my pi image so have started over again, much easier to install the second time, though a little knowledge can be dangerous. I could not find any node of that name when searching inside of NodeRed

    I have a sonoff flashed with TASMOTA , i can see the devices webserver and can control it and configure it, but cant get it to work inside Node-red so i am assuming i have to load some TASMOTA nodes in to build up me Flow. Two days of trying and advanced nowhere so far.

    1. The repository always has the latest version – and if I make changes I always mention it here. but you can just do the install in your .node-red folder as normal – and it will overwrite previous versions – there is also an npn outdated command…
      Tasmota nodes – nope – never used them – but then – why would you? That software communicates via mqtt – just use an mqtt node?

      Oh I see you were just assuming – no – you presumably know how to send and receive mqtt commands or you would not be using Tasmota – so just use the mqtt nodes to send and receive. As for actual details – I suggest the Tasmoto site for that – I use my own software most of the time but I have a few using Tasmota.

      1. Peter i have searched youetube on how to install into the node-red folder but have been unable to.

        i am using Andreas Spiess Pizero image and his code that i flashed on to a sonoff and it works, but the manual push button does not as there appears to be not code in the files for that.

        When i saw a video on Tasomta i thought it would be great to use. It took me two days to get it to work on a sonoff, user error.

        I configured it to use the same topic etc as the sonoff that was working but for the life of me could not get it to work.

        I am now just trying to find something that you can flash the software over the air.

        I have tried Andreas Spiess IOTappstory but have failed there also.

        The problem i am find is that in all the videos simple steps are past over, as they except you to know what they are wanting you to do.

        So to just get a Pi zero to work i am in the process of doing a simple blog post, mainly to remind myself what i have done but it may help others

        So back to my question.

        i have foumd what i think is the TASMOTO nodes that need to be added as i think they are different from the standard one

        and i have been trying to install them into NodeRED, but have not found how to do it.

        If i wanted to install BT (which is already installed by the image that i used) how would i do it if it does not appear in the NodeRed manage palette drop down.

        Sorry if this is a basic question but its driving me mad

        Am i going down the wrong path?


        1. Hi Andy

          Well, I can’t help you with Andreas image – you’ll have to ask him – I don’t know why you don’t use “the script” to install everything…

          I’ve never used a Tasmota node – and as I said earlier – I’ve no idea why you’d want to – the point being that Tasmota sends simple MQTT message back and forth – and you have (or should have) MQTT installed in your Node-Red.

          1. Only because you show it in a VM and i have no idea how to do it with a pi. Andreas just had a large image you could down load and flash on to a SD put it in your pi and it works, within 20mins you have a pi up and running with nodered and mqtt.

            Being a none techie it all just very confusing, yes i am willing to learn but when you do not understand stuff and you keep having to leave say your YT to find another YT to explain what you don’t understand it just very messy and confusing.

            1. Hi

              It really is simple – get a pi, get their image (not the noobs version) – run the script on it – as detailed in the blog – reboot – you’re done… it is all there if you take a look. You need an SD card reader and on my Windows PC I use SDFORMATTER and WIN32DISKIMAGER to copy the Raspbian image – Actually, Raspbian already has Node-Red on it if you want to do it the REALLY easy way but the stuff I put in the script provides a much better total environment – it’s a case of pressing a few buttons and going out for lunch while it does the work. As I say for Andreas’s image – talk to Andreas.

  101. Hi Peter,

    I have been using BT in node red for a irrigation timer that I am building. As I want to use the node red dashboard to input start times i have created a flow that takes a dashboard input for 2 different start times and duration’s for each different station. The flow calls the start time and then it goes through to check if the station is enabled and if so it delivers BT the duration as “timer X”. Once the first station has finished it checks the next and starts the next BT and so on and so forth. My only issue is if I want to stop the timers after I have triggered them. I use the “off” from output 3 to start the next timer in the sequence. That works until I issue the stop command to the input. The BT that gets the stop command shuts its output but the timer continues to run and eventually sends the off command after the preset time. This then triggers the next station and it all starts again. Any ides on how I can get around this?

  102. Hi Peter,

    first of all thanks a lot for this awesome tool. It saves me a lot of time.

    I have a question regarding the inputs. Is there a chance to define the weekdays via an input? I have them already in a database and want to use them.

    Thanks in advance

    Best reagrds


    1. Give me an example of use as I can’t think of a reason to use weekdays in the input – as they can be set in the normal setup…

      1. I wrote a small web app where I can put in the on and off times for my house lights depending on sunset/sunrise. These times are stored into a database incl. the weekdays when the lights should turn on/off.

        Node Red is running as a backend service so I want to be able to make changes for the weekdays only in the web app and not in the node.

        So I thought it would be of interest also for other users to use the weekdays as a input.

        Best regards


  103. Hello Peter!

    First of all THANK YOU on a great great plugin for node red!!!

    I have one question about using “stop” function.
    I have made a UI button with “stop” function and it stops the timer, but every time when I deploy the flow after some changes the timer starts again. Is there any way to make it really suspended with UI button like with suspend thick box in options?

    Thank you!

    1. Ivan I’m sure you could come up with something using the UI to do that. The node itself will obviously reset when changes are made to it – that’s the way Node-Red works.

          1. Yes, that is a problem. Because if I send stop to timer than after reboot the timer is again active, but when I thick susspend box in options the timer is still susspended after reboot and that is ok, but then I need to susspend it from node-red.

            1. That is the intended behaviour – that whatever settings you put in the setup – is there until you change it.

              If there is demand – I’ll put an override in it….

                1. Can I second that.
                  Ability to suspend via a message would be really useful for me. But would also need a matching unsuspend. Running an irrigation system and whilst the off for number of minutes works, for some reason timing values not that reliable on my system. Just a bit suspend and unsuspend would be really useful.

  104. Peter,

    BigTimer is awesome thanks

    Just started using node red in a hosted environment where I don’t control the clock (USA EAST) while I am Australian East coast. The UTC Offset solves the problem mostly (thanks for that) although a first world problem is that I need to be aware of Daylight saving and changing the offset. An ideal solution (although I am not asking for it would be to change/add the UTC offset to a TimeZone field). I appreciate this is significant work for little return but an ability to pass UTC Offset into BigTimer would be awesome

    Thanks again

  105. Peter ignore me a bit of googling would have saved me. I updated the timezone in the hosted env 🙁

    Thanks for an awesome tool

      1. In your computer or server – Bigtimer does not concern itself with timezones – only longitude and latitude for dusk and dawn etc.

  106. Peter, thanks for an awesome node. I’ve been ‘playing’ with Node-Red & Mosquitto on a RPi with some Sonoff switches for a few weeks. Your Big Timer is exactly what I needed to get a couple of standard lamps to come on at sunset – previously they were on mechanical time switches and I found myself adjusting the on/off times every week at this time of year, where the sunset time is changing most rapidly. Now I can sit back and relax whilst Big Timer takes care of the adjustments automatically! Your work is most appreciated, so thank you for sharing this with the world.

    1. And thank you for your kind comments Steve – I created BigTimer precisely to do what the mechanical timers could not – I got so sick of adjusting outside lighting all year because the timer could not handle sunset – and it has grown from there – and no doubt will continue to grow in the future as long as folk remain interested (or I need something new).

  107. Hey Peter,
    For the 1st – Thank you for this awaysome timer.
    For the 2nd – I am newbee in Node-Red and Linux 🙁
    on the search my 10 years old house automation to modernize I am at raspberry and Node-Red landed.
    for the necessary functions I need only a few time-controlled on-off functions. I want to do this with the BigTimer.
    to turn off my radiators after a certain time I use the timeout function. Can I change this time to 3 hours in the UI?
    as first I tried it with the timer, but it is with seconds cumbersome.


    1. But… if you’re going it in the UI, surely you can collect in hours and minutes and send the result of the simple calculation (in a function) to BigTimer. You can do any maths you want inside a function node.

      1. Wow realy fast answer . .
        Maybe you have a example? if I had one I could already adjust it. I do not know this programming language yet

        1. Hi there – sorry – as stated many times – don’t teach programming 🙂 – Javascript is easy… incoming object items of relevance to a function are generally msg.payload… work on that and output the same… Go to the Node-Red site, look at examples. Go to Google groups Node-Red site – ask Node-Red specific programming examples.

  108. Loving this BigTimer module — saves on a huge amount of logic programming so many thanks for that!

    I have a question about feeding it into MQTT.

    I have my topic msg set to “tele/passage/” and ON Msg set to “POWER ON”, I connect the MQTT node to output 1 of BigTimer but my MQTT server receives “stat/passage/ POWER ON” (note the space before the Msg and double space between POWER and ON.)

    The debug output from your module looks fine — any pointers on where it is going wrong?


  109. Hi Peter,

    here again, testing stuff and trying to deploy an irrigation system…
    I’m having an issue with BT, and I’m almost sure it’s something I’m not understanding well. Let me explain:

    I want to start the irrigation system 1 hour after dawn and be active for 30 minutes.
    So I set:
    On time = Dawn
    Off time = 30 minutes
    On offset = 60
    Off Offset = 0

    What I see looking at ‘start’ and ‘end’ fields (second output) is that ‘start’ is Dawn+60minutes, and ‘end’ is Dawn+ 30 minutes, while I would expect ‘end’ to be Dawn+offset+off time, i.e. Dawn+90 minutes to allow 30 minutes of operation after start.

    In fact the timer status reflects “On for 11hrs 19mins” right now, and -in my understanding- it should be off…

    Is it working as designed?

    Thank you for your answer, for your blog and your hard work here. I really learn a lot with all the participants here.

    (Environment: Raspi, your script, long and lat Madrid, CET timezone, time correctly adjusted)

    1. According to what you have above the end time is wrong – surely they should both be dawn, the on time offset 60 minutes and the off time offset 90 minutes

      1. Ok Peter, thanks.
        My interpretation was that ‘off time’ (when filling with x minutes) will mean “work for x minutes” after On time + on offset.

        Hasta pronto!

  110. Hi Peter
    As you know I use your script every time I install a Raspberry and I also use node-red a lot.
    Now I have a small problem with Bigtimer. So far, I did not find a solution:
    I control the lamp in my lab only with PIR sensors, because I do not have regular office hours here and because the lab is in the basement and needs light even during the day.
    I use your “timer 900” command which is triggered by the PIR sensors and it works flawlessly. The only thing is, that I have to make sure that the “big clock” is always off because it supersedes the timer function. First I thought, I could suspend the “big clocK” by the tick mark, but then everything is suspended. Now I have set the ON time to 19:00 and the OFF time to 19:15 because this is a time where I am often in my lab but it would be nicer if I could avoid this 15 minutes on-time every day, Do you know a trick?

    1. Hi Andreas – sorry – I read that twice and I’m still not entirely sure what you are trying to achieve. Why don’t you email me and let’s see if we can come up with a a solution.

  111. Hi Peter. Great blog.

    I have an feature request, could we have a ‘toggle’ input which toggles the output state. It should be treated in a samilar way as ‘on’ and ‘off’ e.g. BigTimer should reassert itself after 24hrs or the next scheduled state change.

    I’m a programmer but currently can’t see a way of implementing this in Node-Red with the existing nodes.


    1. We aim to please… and as that was a good idea…. version 1.7.9 should appear within hours or less…. “toggle” implemented.

  112. Hi Peter,

    Something is stumping me.
    Currently I use BigTimer to switch a light on (20:00) and off (00:30). Easy.
    I also connected a node-red switch in parallel to the timer so I could have manual control.
    However I notice that whenever I use this switch, the initial command (1 or 0) executes but then the Sonoff device that’s connected to it stops responding to the point that I cannot even access it directly over http.

    I have narrowed this down to the timer because if I connect the node-red switch directly to the MQTT output (bypassing the timer), the Sonoff switches states instantly and continuiously as ordered.

    Is this something to do with “timeout”? It is currently set to 720.
    Running BigTimer version 1.7.9


    1. How about removing the link from the output of the timer to the input of the switch and only having the one from the output of the switch to the input of the timer.
      This is how I have an override switch connected

      1. Hi Steve,

        I actually didn’t this originally but soon realised that when the timer went high, the switch still remained in an “off” state.

        Feeding the timer output back into the switch input solves this problem.

        I may play with the new “toggle” ability that Peter has added in the latest update. Maybe this will yield a better result. As soon as I have time that is! 😀

        1. Well, I’ve added toggle now, but it did occur to me that another way would have been a simple function node with a global variable, toggled back and forth each time and outputting “1” or “0” accordingly… hey ho… it is done now…

  113. G’day Pete
    just thought I would share my work in progress with you. Its a greenhouse sensor/automation system which BigTimer is an important part of. I’ve also used the LCD screen you featured on an earier post to preview the programs on the screen. Start time, end time, duration, state etc. Now onto making timer adjustments within the UI which I’ve noticed some mention in your blog.
    Thanks again for all your hard work, BigTimer and sharing your knowledge.

    Regards. Mike

    1. (Newbie here)

      Those dashboards…..

      Love ’em.

      Which (forgotten the term) “library” (?) do they use?

  114. Hi Pete.

    Firstly, Big Timer is excellent. However, I’m new to pi’s, arduinos, and therefore Big Timer, etc., etc.. In my retirement I chose to pursue something new instead of good old relay logic. I loved ’em !!! Therefore, please accept my naivety.

    So now, my problem. I’ve been using inputs that form a ‘master switch’ control into Big Timer, but found that I was getting unexpected results. So, I experimented and discovered that by simply placing Big Timer between an inject node and a debug node, and setting the inject node to send a “stop” message, Big Timer shows itself to have ‘STOPPED’ but continues to send a ‘1’ message at the first node. If I send an “off” message, it then sends a ‘0’ but does not shut down completely. I need the system to fully shut down.

    Note: Within Big Timer, I have set up the input message to ‘1’ and the output to ‘0’, and there are no ‘text’ messages and no ‘topic’ set. ‘On Time’, ‘Off Time’, ‘Lat’ and ‘Long’ are all set.

    If I’m doing something wrong, please HELP. Otherwise, I may be back to my relays!

    Regards, John.

    1. If you send the message “stop” as a string from, say, an inject node… i.e. a msg.payload of “stop” – then nothing more will come out of the FIRST output of BigTimer. I’m sitting looking at it here and have been for the last 5 minutes. If you then send the message “auto” it will start up again.

      Are you sure you are sending “stop” in the payload and not the topic… and are you sure you are looking at the topmost output from BigTimer…

      You say that within node-red you have set the input message. There is no input message. I assume you meant the on and off messages.

    2. on and off are not the same as stop and auto of course – on and off are simple manual overrides affecting the state of the output. STOP actually stops all output form the top most (first) output of BigTimer.

  115. I much appreciate your quick response.

    It seems I had not understood the specifics of the ‘stop’ input and the output nodes – I was connected to the second one.

    I was sending a text ‘stop’ as payload input. Connecting to the first output node it does indeed stop everything. However, I wanted a ‘0’ output from Big Timer to stop all other activities downstream – this would have been ideal.

    I am somewhat curious to know why a ‘1’ message is given from the second node when Big Timer is stopped. A ‘0’ output would have been more logical (and useful for me).

    OK, I will have to find a workaround to bypass Big Timer and get the rest downstream to stop working.

    Thanks for your time.


    1. Probably the reason you’re seeing a ‘1’ on the second output is because the unit is not set to state 0… it is just stopped – two completely different things. The simple solution is not to use the second output. The primary output is the first one.

      However, on the second output if you look at msg.state you will find that it says something like “OFF Auto” normally but when the unit is stopped it will say “OFF Stopped”…. so really all you need to do is stick a function node containing the following, on the second output:

      if (msg.state.toLowerCase().indexOf(“stopped”)==-1) return msg;

      Easy solution.

  116. If you want connect two big timer to one output, here is OR function node which do OR over two incoming messages. This works best with checked Repeat output and Output at startup in bigtimer settings.

    var msgCount = context.get(‘count’)||0;
    var msgGlobal = context.get(‘msg’)||0;

    msgGlobal = msgGlobal || ((msg.payload == “1”) ? 1 : 0);

    if (msgCount == 2) {
    msg.payload = msgGlobal;

    if (msgGlobal == 1) {
    node.status({fill:”green”, shape:”dot”, text:”ON”});
    } else {
    node.status({fill:”blue”, shape:”dot”, text:”OFF”});

    context.set(‘count’, 0);
    context.set(‘msg’, 0);

    return msg;

    context.set(‘count’, msgCount);
    context.set(‘msg’, msgGlobal);
    return null;

    1. Great solution!
      I wonder though, if anyone else but me think it would be great with two sets of timers i one node, so you don’t have to add a second node? What do you think, Pete?

  117. Pete.

    I’m getting out of my depth here. My last stab at programming was Fortran way back when. I don’t really know what ‘ if (msg.state.toLowerCase().indexOf(“stopped”)==-1) return msg; ‘ should do, but all I get is a response message saying ‘ TypeError: Cannot read property ‘toLowerCase’ of undefined ‘.

    What I have done is put a function node in parallel with Big Timer containing ‘ if (msg.payload = “stop”) { msg.payload = “0”} return msg; ‘, and it has solved my problem.

    Thanks all the same.

    1. John

      If you’re going to mess with Node-Red I STRONGLY recommend getting a beginner’s book on Javascript (nothing old) otherwise you are going to hit this time and time again and eventually give up. I cannot imagine Fortran knowledge being helpful here. The good news is that Javascript is interpretive so you can mess around without compiling stuff.

      The function nodes take in a message – which is an object. It has things like msg.payload and msg.topic – but you can add more – like msg.fred=1; for example. In this case, the message (msg) from BigTimer (SECOND OUTPUT) contains msg.state which is simply a character string which might contain for example “OFF Stopped”. As I don’t want to start worrying about uppercase and lowercase, I added the METHOD to turn the whole lot into lower case… ie msg.state.toLowerCase

      I then want to search for a string within a string – ie the lower case word “stopped”… that is done by adding indexOF at the end.. if it can’t find anything it returns -1 – hence the line I gage you only returns a message if “stopped” isn’t in there… otherwise the function merely ends without returning anything.

  118. Hi getting to grips,with big timer love it thanks

    How can I show how long to go until on time on node-red dashboard and how to go before switch of time please

    1. Good morning Nigel.

      That is an excellent question and one which until now could not be answered. If you would care to update to the latest version as of this morning – you will find that the msg objects output from the first and second outputs – now include msg.duration in minutes.



      1. Morning Pete

        Glad you liked my question. I have updated big timer and now can see duration in minutes. If I wanted to display in hours I would need to x 60. Would I need a function node to do this. I cannot code could you give me a Idea please.

        1. A reminder to all about the message on my blog – I don’t do training – that is what Google is for – mind you a donation to the blog can always change my mind if it is easy.

          Yes you will need a function node…. drop it in and… well, this might give you a head start…

          msg.payload= “Off for ” + pad(parseInt(duration / 60), 2) + “hrs ” + pad(duration % 60, 2) + “mins”

  119. Pete

    this is really interesting all this time stuff, is there a start time for bigtimer to start timing from ie 00.00 midnight or is it sun depenent?and start from sunrise

    as i cant see why 10.00 would be start=600

    payload: 0
    reference: “:1:0:592”
    topic: “status”
    state: “OFF Auto”
    time: “00hrs 08mins”
    name: “Big Timer”
    start: 600
    end: 630
    dusk: 990
    dawn: 436
    solarNoon: 713
    sunrise: 477
    sunset: 949
    night: 1075
    nightEnd: 351
    now: 592
    timer: 0
    duration: 8
    onOverride: -1
    offOverride: -1

  120. Hi Pete
    currently writing function to turn on and off outside lights by pinging android phones to detect presance (won’t work with i-phones wi-fi sleep etc, etc) obviosley i don’t want them to come on when its light outside. So i thought use BigTimer dusk / dawn to set a global then my function can just test the global.get. although this would work ok, and i have many of your big timers in my flows, is there a way to just check for dusk /dawn without having the big timer setting the global. ie global.get from one of the many other big timers in my flows ?

  121. Hello Pete,
    Could I suggest an option for First/Last (Weekday) of the month.
    The current options only let you choose the week.
    For example: Last Sunday of March (Clock change!!) I enter weekday 1 week 4 and weekday 1 week 5 on the timer. This (Some years) when there are 5 Sundays in March will trigger twice.

  122. Hello,
    I found that BT returns wrong values when Node red is running on Synology. Only remaining time is same, start, dusk, sunrise, now, etc. are one hour less. Left side on the picture is PI3, right side Synology. Settings, (time, location, timezone) are same.

      1. On picture above is time on both platforms 17:39, I expect that this is system platform time.
        Nevertheless time on Synology is correct in DSM and also in shell.

        1. I compared component SUN in Home assistant. Left side is PI3, right side Synology. Both platforms show correct values. It looks like issue is in BigTimer.

            1. One more test. I added node sunrise with same coordinations.
              At 15:14 BT says is past sunset, but node sunrise shows still day, which is correct. I looks like problem with timezone for sun events, time NOW is correct.
              Maybe that problem is on the way between BT and Synology (Node red, python, docker… ?)

  123. Hi,
    first of all very very good work. Thanks
    I noticed the following:
    I want to use BigTimer as simple timer via injecting “timer xx”.
    so far so good. but i don’t want any schedules. but if i check suspend schedule the timer also dosn’t work anymore.
    kind regards

  124. I am using bigtimer with Home Assistant. The Home Assistant service call node requires the input to be in a strict JSON format, i.e. {“service”:”turn_on”}. I’ve tried to get bigtimer to output a message exactly in this format by putting that in the ON Msg (or OFF Msg) config field, but the debug output shows its then sending the msg as payload: “{“service”:”turn_on”}” (notice the extra quotes around the brackets.

    Is there any way for me to configure this with the correct JSON?

    1. I would +1 this request. I also need to send JSON messages. Currently I need a function node in between to translate from text to jsnon. My preference(from a user perspective), would be tohave the payload edit field be identical to one in the standard inject node. Here you can choose from a dropdown menu what the payload type is. You can choose text and json and then fill in the data in the edit box.

  125. Hi,
    i really like bigtimer, starting using it for automated 433Mhz electric socket.
    Now i´ve learned how to use the override which is fine.

    Is it possible to change the on off time with input variables ? Would be fine to build a ajustible timer for waking up in the morning

    Would be really great if it´s possible

  126. Hi Pete,

    Love the Big Timer, just started playing with it now.

    One thing I noticed, and I worked around it by changing my Deploy to ‘only nodes that have changed’, was that every time you click Deploy in a ‘deploy all nodes’ setting it resets the Big Timer back to auto even if I’d turned it off or stopped it. Took me a while to figure out what was happening when I was working on other parts of my automation. Just something for the noobs out there like me.

    Second thing is the ‘speech/txt output’ only outputs when the timer sends out an on or off signal. Would be great to have this also output the state of the timer, so I can see on my dashboard whether it’s actually stopped, or only temporarily off etc.

    I’d like to have it turn the output off when I stop the timer too. At the moment when I stop it, it just leaves everything on as it was. Is that possible?


  127. Hello, I’m starting with Bigtimer to send notifications to my SLACK, but I need to know how I can schedule for specific DAY of the month, independent of month of the year.

    For example: Every Day 5 at 12:00

    I tried to put in DAY1: 5 and keep Month with 0 but not works.

    Can you help me?

    Thank you very much

  128. I really appreciate this smart timer. But in the very moment I need help. I want to use this timer only at Mondays, Tuesdays and Wednesdays, but I need a topic/payload-massage the other days due to an AND-function which I realize with a join-node. When I blank i.e. Friday, Big-Timer’s status is ‘No action today’ with no message at any output. Any idea?

      1. Thanks Pete! So, is there a way, for example: I want ot start something for the next 3 month and stop it in other 3 months… Is there a way to setup that?

  129. Hello Pete

    just spotted your comment- I am so pleased to see you a bit active again, and that you will soon be back to your family and friends.

    Just to show how much help your blog has been to me – have script running in various mods on my system. Have boards running, even managed to do Eclipse and made some roms just changing the passwords etc. Done flows in Nodered
    on Rpi- . This all in the last quarter of 2017. This for my sons house. I never thought at my age I could do this. MANY Thanks TO YOU.

    This website has formulas for virtually every programming language to convert
    Epoch time might be of interest.



  130. Hi.
    I’m not able to stop the Timer by Inject PayLoad ‘stop’. All other like ‘on,off,auto’ are functional. Any idea why ‘stop’ is not working ?

  131. Is Override really Override?
    I thought that a manual Override of the BigTimer (v1.8.0) would force the output at any time, but it only works on scheduled days and also if it’s not suspended.
    So if I’d like to manually turn on my lights on a non-scheduled-day, then I need to pass the On/Off messages not only to BigTimer but also straight to the node at the output of BigTimer. And that would make on_override HH:mm kind of useless since you yourself needs to remember if it is a scheduled day or not, otherwise the BigTimer does nothing. Funny enough thedot (node.status) is updated regardles.

    if ((!node.suspend) &&(goodDay)) { … node.send([outmsg1, outmsg2, outmsg3]) … }

    Well, apart from that, BigTimer is great work!

  132. Is there a possiblity to configure the timer completely from the UI?
    For examle to specify the Weekedays or the Months?

    I would like to create a special Alarm Clock which is modifyable. But it seems the commands accepted are limited?

  133. Hi Peter
    Thanks for BigTimer, it is really great!
    But I have a little problem with it when I want to override the timer. In my node you can see that I inject bigTimer with the MQTT payload to temporally override the timer. When I do this with a debug node at the end it works fine but as soon as I connect the output back to the MQTT output the system (Raspberry PI) goes down.

    On the right side you can see the debug messages when fireing some MQTT messages from my smartphone to override the timer.

    Do you have any idea why the system goes down as soon as I connect BigTimer to the MQTT output?


  134. Is there a way to change on wihch days the timer repeats, by input?
    For example:
    You send a msg with Monday = true and Saturday = false to let the timer repeat on Monday but not on Saturday.

    1. The repeat only refers to the output message. You turn the timer on and off by selecting which days you want it to run.

          1. It would help me immmensely if you would put your signature and date on any changes so I can easily identify and test before incorporating.

  135. Hi Peter… I love what you’ve done with bigtimer. 🙂 I downloaded it a put it into a bunch of light flows I have for evening scenes in my house, however, once I replace the standard time node with bigtimer, they stopped working. 🙁

    I’ve done some troubleshooting, and I find that no matter what time setting I try, or manual inputs I push through bigtimer, I NEVER get anything out of the first (topmost) output on bigtimer. If I connect debug to the second output, I get the message as intended, at switch time, and every minute as well, and when I manually push ON or OFF through input. But in any of those circumstances, I NEVER see any output through the first output… Any ideas why this isn’t working?

    PS – I have tried this on several different new bigtimer nodes, and even on multiple tabs and flows… I get the same results each time. Thanks for any advice!!

        1. I’m using 1.9.1 and I’m seeing the same behavior with the first output not outputting anything. I’ve tried injecting both numbers/letters. I swear this was working yesterday with the exact same flow.

          I’m seeing this in my logs.
          15 Apr 21:41:57 – [info] [mqtt-broker:adb4bcac.b3178] Connection failed to broker: node-red@mqtt://

          1. I pointed out earlier that the temporary manual override won’t do it – there is nothing to override. Input “manual” first, then 1 or 0. I have it working here and that is what was published. 1.9.0 worked fine but I’d neglected to update the status display on the node itself hence 1.91 – let me know how that goes.

  136. Hi Peter. Good job on the bigtimer.
    I noticed that the override input does not produce any output if the day is not selected. In other words, the override does not work on the unselected days. The info under the node box changes but no output.
    Thank you,

    1. Right, I’m taking a look at this. There are two types of override, temporary and permanent. It makes no sense to have a temporary override to a timer that is not on today, but perhaps the permanent override could run regardless.

      I’ll need to ensure this does not create any conflicts, and if not, then I’ll arrange so that if you preselect manual then select 1 or 0, there’s an output regardless.

      That should keep everyone happy.

  137. Hi Pete

    If I have only one day checked (Thursday) I can’t override state by injecting on/off on another day.
    Is it expected behaviour?

  138. There is what I try to achieve:
    Scheduled on Thursday but could be on for 1 minute anytime..

    Flow below:

    [{“id”:”ef59c07a.7f32e”,”type”:”bigtimer”,”z”:”f37d448c.779bb8″,”outtopic”:”bigtimer”,”outpayload1″:”on”,”outpayload2″:”off”,”name”:”Big Timer”,”lat”:”55.019300″,”lon”:”-7.777090″,”starttime”:”1200″,”endtime”:”1260″,”startoff”:0,”endoff”:”0″,”offs”:0,”outtext1″:”on”,”outtext2″:”off”,”timeout”:1440,”sun”:false,”mon”:false,”tue”:false,”wed”:false,”thu”:true,”fri”:false,”sat”:false,”jan”:true,”feb”:true,”mar”:true,”apr”:true,”may”:true,”jun”:true,”jul”:true,”aug”:true,”sep”:true,”oct”:true,”nov”:true,”dec”:true,”day1″:0,”month1″:0,”day2″:0,”month2″:0,”day3″:0,”month3″:0,”day4″:0,”month4″:0,”day5″:0,”month5″:0,”d1″:0,”w1″:0,”d2″:0,”w2″:0,”d3″:0,”w3″:0,”d4″:0,”w4″:0,”d5″:0,”w5″:0,”suspend”:false,”random”:false,”repeat”:true,”atstart”:true,”odd”:false,”even”:false,”x”:448.3660583496094,”y”:190.52999877929688,”wires”:[[“ad78c49a.4bcfa8”],[“542d8484.494a3c”],[“43a67352.2cfa0c”]]},{“id”:”ad78c49a.4bcfa8″,”type”:”debug”,”z”:”f37d448c.779bb8″,”name”:””,”active”:true,”tosidebar”:false,”console”:false,”tostatus”:true,”complete”:”payload”,”x”:667.3290405273438,”y”:139.01602172851562,”wires”:[]},{“id”:”542d8484.494a3c”,”type”:”debug”,”z”:”f37d448c.779bb8″,”name”:””,”active”:true,”tosidebar”:false,”console”:false,”tostatus”:true,”complete”:”payload”,”x”:667.3200073242188,”y”:189.0159912109375,”wires”:[]},{“id”:”43a67352.2cfa0c”,”type”:”debug”,”z”:”f37d448c.779bb8″,”name”:””,”active”:true,”tosidebar”:false,”console”:false,”tostatus”:true,”complete”:”payload”,”x”:671.300048828125,”y”:244.01998901367188,”wires”:[]},{“id”:”1872cacd.bf5b45″,”type”:”change”,”z”:”f37d448c.779bb8″,”name”:”default”,”rules”:[{“t”:”set”,”p”:”payload”,”pt”:”msg”,”to”:”default”,”tot”:”str”}],”action”:””,”property”:””,”from”:””,”to”:””,”reg”:false,”x”:94.96902465820312,”y”:268.9590148925781,”wires”:[[“49dac20e.fda04c”]]},{“id”:”49dac20e.fda04c”,”type”:”delay”,”z”:”f37d448c.779bb8″,”name”:””,”pauseType”:”delay”,”timeout”:”1″,”timeoutUnits”:”minutes”,”rate”:”1″,”nbRateUnits”:”1″,”rateUnits”:”second”,”randomFirst”:”1″,”randomLast”:”5″,”randomUnits”:”seconds”,”drop”:false,”x”:259.38299560546875,”y”:226.09901428222656,”wires”:[[“ef59c07a.7f32e”]]},{“id”:”3a8a9b85.1f18d4″,”type”:”inject”,”z”:”f37d448c.779bb8″,”name”:””,”topic”:””,”payload”:”on”,”payloadType”:”str”,”repeat”:””,”crontab”:””,”once”:false,”onceDelay”:0.1,”x”:89.49502563476562,”y”:189.04501342773438,”wires”:[[“1872cacd.bf5b45″,”ef59c07a.7f32e”]]}]

  139. Hi Pete,
    A wonderful and very powerfull timer you made! Thank you for that.
    Apart from the single timer use, i try to use it as your example above using TWO timers. But That doed not work with me. I am sure i probably missed some setting, but when i configure bothe timers, with different times of cource, as soon BigTimer 1 fires ON, after one minute BigTimer 2 will switch it OFF.
    And that continues.
    Can you explain me what i am doing wrong here? I put the config here:

    “id”: “b48d24b6.510718”,
    “type”: “bigtimer”,
    “z”: “1cb8a570.7e361b”,
    “outtopic”: “”,
    “outpayload1”: “ON”,
    “outpayload2”: “OFF”,
    “name”: “Big Timer”,
    “lat”: “51.995”,
    “lon”: “5.22778”,
    “starttime”: “480”,
    “endtime”: “480”,
    “startoff”: “5”,
    “endoff”: “10”,
    “offs”: 0,
    “outtext1”: “Lamp Aan”,
    “outtext2”: “Lamp Uit”,
    “timeout”: 1440,
    “sun”: true,
    “mon”: true,
    “tue”: true,
    “wed”: true,
    “thu”: true,
    “fri”: true,
    “sat”: true,
    “jan”: true,
    “feb”: true,
    “mar”: true,
    “apr”: true,
    “may”: true,
    “jun”: true,
    “jul”: true,
    “aug”: true,
    “sep”: true,
    “oct”: true,
    “nov”: true,
    “dec”: true,
    “day1”: 0,
    “month1”: 0,
    “day2”: 0,
    “month2”: 0,
    “day3”: 0,
    “month3”: 0,
    “day4”: 0,
    “month4”: 0,
    “day5”: 0,
    “month5”: 0,
    “d1”: 0,
    “w1”: 0,
    “d2”: 0,
    “w2”: 0,
    “d3”: 0,
    “w3”: 0,
    “d4”: 0,
    “w4”: 0,
    “d5”: 0,
    “w5”: 0,
    “suspend”: false,
    “random”: false,
    “repeat”: true,
    “atstart”: true,
    “odd”: false,
    “even”: false,
    “x”: 380,
    “y”: 500,
    “wires”: [
    “id”: “30c420c.04cb06”,
    “type”: “debug”,
    “z”: “1cb8a570.7e361b”,
    “name”: “BigTimer 1/2”,
    “active”: true,
    “tosidebar”: true,
    “console”: false,
    “tostatus”: false,
    “complete”: “true”,
    “x”: 630,
    “y”: 500,
    “wires”: []
    “id”: “f2932925.8f0b28”,
    “type”: “inject”,
    “z”: “1cb8a570.7e361b”,
    “name”: “”,
    “topic”: “”,
    “payload”: “ON”,
    “payloadType”: “str”,
    “repeat”: “”,
    “crontab”: “”,
    “once”: false,
    “onceDelay”: 0.1,
    “x”: 150,
    “y”: 440,
    “wires”: [
    “id”: “8b76f042.21ecd”,
    “type”: “inject”,
    “z”: “1cb8a570.7e361b”,
    “name”: “”,
    “topic”: “”,
    “payload”: “AUTO”,
    “payloadType”: “str”,
    “repeat”: “”,
    “crontab”: “”,
    “once”: false,
    “onceDelay”: 0.1,
    “x”: 150,
    “y”: 520,
    “wires”: [
    “id”: “a153cf39.3aacb8”,
    “type”: “inject”,
    “z”: “1cb8a570.7e361b”,
    “name”: “”,
    “topic”: “”,
    “payload”: “OFF”,
    “payloadType”: “str”,
    “repeat”: “”,
    “crontab”: “”,
    “once”: false,
    “onceDelay”: 0.1,
    “x”: 150,
    “y”: 480,
    “wires”: [
    “id”: “1cded6b0.d966e9”,
    “type”: “bigtimer”,
    “z”: “1cb8a570.7e361b”,
    “outtopic”: “”,
    “outpayload1”: “ON”,
    “outpayload2”: “OFF”,
    “name”: “Big Timer”,
    “lat”: “51.995”,
    “lon”: “5.22778”,
    “starttime”: “480”,
    “endtime”: “495”,
    “startoff”: “12”,
    “endoff”: “10”,
    “offs”: 0,
    “outtext1”: “Lamp Aan”,
    “outtext2”: “Lamp Uit”,
    “timeout”: 1440,
    “sun”: true,
    “mon”: true,
    “tue”: true,
    “wed”: true,
    “thu”: true,
    “fri”: true,
    “sat”: true,
    “jan”: true,
    “feb”: true,
    “mar”: true,
    “apr”: true,
    “may”: true,
    “jun”: true,
    “jul”: true,
    “aug”: true,
    “sep”: true,
    “oct”: true,
    “nov”: true,
    “dec”: true,
    “day1”: 0,
    “month1”: 0,
    “day2”: 0,
    “month2”: 0,
    “day3”: 0,
    “month3”: 0,
    “day4”: 0,
    “month4”: 0,
    “day5”: 0,
    “month5”: 0,
    “d1”: 0,
    “w1”: 0,
    “d2”: 0,
    “w2”: 0,
    “d3”: 0,
    “w3”: 0,
    “d4”: 0,
    “w4”: 0,
    “d5”: 0,
    “w5”: 0,
    “suspend”: false,
    “random”: false,
    “repeat”: true,
    “atstart”: true,
    “odd”: false,
    “even”: false,
    “x”: 380,
    “y”: 660,
    “wires”: [
    “id”: “a72c8d85.0e898”,
    “type”: “debug”,
    “z”: “1cb8a570.7e361b”,
    “name”: “BigTimer 2/2”,
    “active”: true,
    “tosidebar”: true,
    “console”: false,
    “tostatus”: false,
    “complete”: “true”,
    “x”: 630,
    “y”: 660,
    “wires”: []
    “id”: “23eb978.f6597e8”,
    “type”: “inject”,
    “z”: “1cb8a570.7e361b”,
    “name”: “”,
    “topic”: “”,
    “payload”: “ON”,
    “payloadType”: “str”,
    “repeat”: “”,
    “crontab”: “”,
    “once”: false,
    “onceDelay”: 0.1,
    “x”: 150,
    “y”: 600,
    “wires”: [
    “id”: “9a3b9767.dd1cd8”,
    “type”: “inject”,
    “z”: “1cb8a570.7e361b”,
    “name”: “”,
    “topic”: “”,
    “payload”: “AUTO”,
    “payloadType”: “str”,
    “repeat”: “”,
    “crontab”: “”,
    “once”: false,
    “onceDelay”: 0.1,
    “x”: 150,
    “y”: 680,
    “wires”: [
    “id”: “51754311.d90474”,
    “type”: “inject”,
    “z”: “1cb8a570.7e361b”,
    “name”: “”,
    “topic”: “”,
    “payload”: “OFF”,
    “payloadType”: “str”,
    “repeat”: “”,
    “crontab”: “”,
    “once”: false,
    “onceDelay”: 0.1,
    “x”: 150,
    “y”: 640,
    “wires”: [
    “id”: “bd742da5.8ced98”,
    “type”: “mqtt out”,
    “z”: “1cb8a570.7e361b”,
    “name”: “Sonoff_8S20”,
    “topic”: “tasmota/Sonoff_7S20/cmnd/POWER”,
    “qos”: “”,
    “retain”: “”,
    “broker”: “63290974.7c5b1”,
    “x”: 630,
    “y”: 580,
    “wires”: []
    “id”: “63290974.7c5b1”,
    “type”: “mqtt-broker”,
    “z”: “”,
    “name”: “”,
    “broker”: “”,
    “port”: “1883”,
    “clientid”: “”,
    “usetls”: false,
    “compatmode”: true,
    “keepalive”: “60”,
    “cleansession”: true,
    “willTopic”: “”,
    “willQos”: “0”,
    “willPayload”: “”,
    “birthTopic”: “”,
    “birthQos”: “0”,
    “birthPayload”: “”

    1. Sorry, my description above of the behaviour is not correct.
      As BigTimer 1 fires, almost immediately BigTimer 2 switches off. And after one minute this process repeats itselve.
      The same when BigTime 2 is on its turn to fire. Then BigTimer 1 switches immediately off. with the repeat after one minute…

      Btw, it does not make a difference when i use my own broker in stead of

      1. I can only speak for installations using local mosquitto (as per “the script”) though I’m not sure what any of that has to do with BigTimer.

  140. Hi Pete,
    Sorry for this question. You already answered this to Gordon McLellan.
    issue solved. Please delete my stupid question 😉 I should have read all comments thorougly.
    Thanks again for a great timer!
    Kind regards, Bert

  141. When I override the node by sending a msg the node sends my ON Text. Can I stop this? So, when I ovveride the note by msg it dosen’t output anything?

  142. Ok, I’m stuck.

    On an older (now deleted) flow in NR, BigTimer worked.

    I can’t vouch for the EXACT times, but for Sunrise/Set they were close enough for what I needed.

    The computer died, I lost the flow. Had to rebuild. Got latest version of BigTimer.
    AFAIK, I put in the same values.

    The times it gives me back are…….. weird.

    Screen shot included.
    Local time: 21:59
    Location: S 33.51
    E 151.12
    Date 5/5/2018
    Nominal Sunrise/set times: 06:10 17:20
    BigTimer is telling me the sun will set in 1 hour 46 minutes from now. 21:59.

    Nah. It set a LONG time ago.

    Granted the On Time Off Time may not be correct. As the UTC Offset.

    Tried permutations of. No better.

    Can someone tell me what I am missing?

    1. Hello Village
      It seems you have set Off time to a fixed time 23.45. In the dropdown choose Dawn, or some other variabel which depend on the sun.
      There is 1 hour 46 min from 21.59 to 23.45.
      Best regards Brian, Denmark

  143. Thanks.

    What was also “killing me” was the ON/OFF SUNRISE/SUNSET.

    See attached.

    Local time is 11:45
    It is set to: ON TIME = SUNRISE
    ON TEXT = Sun rise
    OFF TEXT = Sun set – though you can’t see that.
    Bit of you look to the right: It has just said: Sun set.
    If I reverse the ON TIME and OFF TIME, it gives me Sun rise now.

    Another problem I also noticed is the “Repeat output” button is TICKED.
    This was explained that if set, it (big timer) would send out the message every minute.

    See second attached picture.
    I reversed the On Time and Off Time settings to the opposite to what I would have thought. The message was then sent: Sun rise. That was at 11:45.

    It is now 11:53 and there has only been ONE output.
    What am I missing?

    Oh, only 1 attachment per post. Stand bye.

  144. Hello Andrew
    I have just tested and have no problems. I run node red 0.17.5 and node.js 6.x as I remember. Bigtimer is 1.8.0 so I am not on newest version. It puts out at message from first output every minute.
    For test you can set Your debug node to show “complete msg object”. You Will then have at lot more information from Bigtimer, which You Can show here.
    Regarding to sunrise/sunset confusion, it might be the Man UTC, which You have set to 10 hours. This shift both sunrise and sunset.
    I think Longitude should be with minus when You are East. Then I think You Can see sunrise and sunset-times to be OK. Have Man UTC to 0 and 12 and look below the node, as You have already in a square, to see next change. With wrong sign, it become about 20 hours off track.
    Best regards Brian

    1. I was wrong about the sign. That part is right in Your setting if You live netarkiv Sydney. Mine are 55.11 , 10.17 🙂 and calculation of sunrise/sunset seem OK.

  145. Thanks.

    Well, the confusion grows.

    I’ve deleted the UTC offset and things are looking better.

    The “Every minute” problem is resolved.

    I was looking at the wrong output. Sorry.

  146. Ok, something is going on.

    Today I am programming and look at BIG TIMER’s output.

    It says the sun will rise in about 3 hours.

    Local time is 13:50.

    It was (or seemed to be) behaving yesterday.

  147. Well, after a lot of messing about I made a bit of code to help me try and track down what is going on.

    See attached.

    The times are right as per what BigTimer says, so why is it telling me that it is night time?

    The DayMode button is to the left, meaning NIGHT MODE.

  148. Pete quick question: How can I display the time info in my GUI interface as at the bottom of the big timer node in the node-red design flow? Thanks Ron.

  149. Sir allow me re phrase the question.from the screen grab you see your basic example with my mods. under big time you see the timer info I refer too. I am not asking how to make a GUI page rather how to get that time data out of big timer to do with what I may. I want to display X min till on or X min to off. Hope this clears the question up. Ron.

    1. Hi

      Outputs from Bigtimer are described in the readme. Where you send them to is up to you. Not at my computer but all outputs start with msg. and there is far more than just .payload

      1. I’ve updated the BigTimer documentation – in the first two outputs you can grab msg.duration which will tell you in minutes how long to the next change of state. Also the value shows the time now in minutes after midnight.

    2. Here is my effort though there is a “bug” that the times are not formatted to be two digits.
      So if sunset is (say) 18:03 you get 18:3

      String node.

      Hope it helps.

      Code follows:
      [{“id”:”2fff825f.4c298e”,”type”:”function”,”z”:”c636aa5a.cc34″,”name”:”Build message”,”func”:”// zeroPad(5, 2);\nvar sunrise_H = parseInt(msg.sunrise / 60);\nvar sunrise_M = msg.sunrise % 60;\nvar sunset_H = parseInt(msg.sunset / 60);\nvar sunset_M = msg.sunset % 60;\nmsg.payload = \”Sunrise \”;\nmsg.payload += sunrise_H;\nmsg.payload += \”:\”;\nmsg.payload += sunrise_M;\nmsg.payload += \” Sunset \”;\nmsg.payload += sunset_H;\nmsg.payload += \”:\”;\nmsg.payload += sunset_M;\nmsg.payload += \” \\r\\n \”;\nmsg.payload += msg.state;\nreturn msg;”,”outputs”:1,”noerr”:0,”x”:470,”y”:150,”wires”:[[“37a58358.ee718c”]]},{“id”:”37a58358.ee718c”,”type”:”split”,”z”:”c636aa5a.cc34″,”name”:””,”splt”:”\\n”,”spltType”:”str”,”arraySplt”:1,”arraySpltType”:”len”,”stream”:false,”addname”:””,”x”:620,”y”:150,”wires”:[[“dadb071b.eb16f”]]},{“id”:”dadb071b.eb16f”,”type”:”string”,”z”:”c636aa5a.cc34″,”name”:””,”methods”:[{“name”:”trimRight”,”params”:[]}],”prop”:”payload”,”propout”:”payload”,”object”:”msg”,”objectout”:”msg”,”x”:740,”y”:150,”wires”:[[“e212189.8b4fc68”]]},{“id”:”e212189.8b4fc68″,”type”:”switch”,”z”:”c636aa5a.cc34″,”name”:””,”property”:”payload”,”propertyType”:”msg”,”rules”:[{“t”:”cont”,”v”:”Sunrise”,”vt”:”str”},{“t”:”else”}],”checkall”:”true”,”repair”:false,”outputs”:2,”x”:860,”y”:150,”wires”:[[“c9ef329a.334a48”],[“99ccbaea.dc46c”,”c86cd450.f1626″,”2873e35b.cb383c”]]},{“id”:”c9ef329a.334a48″,”type”:”split”,”z”:”c636aa5a.cc34″,”name”:””,”splt”:”13″,”spltType”:”len”,”arraySplt”:1,”arraySpltType”:”len”,”stream”:false,”addname”:””,”x”:990,”y”:150,”wires”:[[“86068149.7ef358”]]},{“id”:”86068149.7ef358″,”type”:”switch”,”z”:”c636aa5a.cc34″,”name”:””,”property”:”payload”,”propertyType”:”msg”,”rules”:[{“t”:”cont”,”v”:”Sunrise”,”vt”:”str”},{“t”:”cont”,”v”:”Sunset”,”vt”:”str”}],”checkall”:”true”,”repair”:false,”outputs”:2,”x”:1110,”y”:150,”wires”:[[“6a18edea.14f8bc”,”b9735a41.7b3e3″,”102884b3.42318b”,”b00a2963.bce03″],[“2ff54103.bf99d6″,”d0e40658.d09b2″,”a64ffaf0.de09c8″,”263c048a.3e52d4”]]},{“id”:”6a18edea.14f8bc”,”type”:”debug”,”z”:”c636aa5a.cc34″,”name”:”HS”,”active”:false,”tosidebar”:true,”console”:false,”tostatus”:false,”complete”:”payload”,”x”:1260,”y”:110,”wires”:[]},{“id”:”b9735a41.7b3e3″,”type”:”ui_text”,”z”:”c636aa5a.cc34″,”group”:”143d1a28.fd350e”,”order”:2,”width”:”5″,”height”:”1″,”name”:””,”label”:”Sunrise time”,”format”:”{{msg.payload}}”,”layout”:”row-spread”,”x”:1280,”y”:140,”wires”:[]},{“id”:”2ff54103.bf99d6″,”type”:”debug”,”z”:”c636aa5a.cc34″,”name”:”HJ”,”active”:false,”tosidebar”:true,”console”:false,”tostatus”:false,”complete”:”payload”,”x”:1260,”y”:170,”wires”:[]},{“id”:”d0e40658.d09b2″,”type”:”ui_text”,”z”:”c636aa5a.cc34″,”group”:”143d1a28.fd350e”,”order”:3,”width”:”5″,”height”:”1″,”name”:””,”label”:”Sunset time”,”format”:”{{msg.payload}}”,”layout”:”row-spread”,”x”:1280,”y”:200,”wires”:[]},{“id”:”143d1a28.fd350e”,”type”:”ui_group”,”z”:””,”name”:”Times”,”tab”:”4bedbfa3.4576c”,”order”:1,”disp”:true,”width”:”5″,”collapse”:false},{“id”:”4bedbfa3.4576c”,”type”:”ui_tab”,”z”:””,”name”:”Sun Times”,”icon”:”dashboard”,”order”:5}]

  150. Hi Peter
    is it possible to use bigtimer if i want to turnOff a switch after 120min? If switch turnOn then wait 120 min before it should turnOff

    I am using bigtimer for sunrise and sunset and that works great but i have not got the timer settings to work. (because i do it wrong…)

    Jonny Larsson

      1. when i turnOn my switch i want bigtimer to automatically turnOff after 120minutes.

        sorry if it was unclear.


        1. The purpose of bigtimer is to switch things on and off at certain times of the day. Check out my node node-red-contrib-timeout if you want something turning off x minutes after you turn it on….

  151. Peter,

    One thing I would like to check is output #2’s “formatting”.
    As I mentioned in my reply to another person asking about breaking down the times, if the minute value is less than 10, it is truncated to just a single digit.

    Though “legal” it is confusing to read.

    eg: Sunset 18:03.
    Rather than seeing 18:03, the time is output as 18:3.

    I know a bit of magic can fix it, but I’m just asking could it be formatted with leading zeros before it is sent out?

  152. Hi Pete,
    I’ve come across a bug with version Big Timer version 1.9.2.
    If “Night” is selected as the On Time and “Night end” as the off time, and Latitude and Longitude values are populated then it produces a “Not a Number” error in both the output and the text displayed below the node…

    status : msg : Object
    payload: 0
    reference: “:::525”
    topic: “status”
    state: “OFF Auto”
    time: “NaNhrs NaNmins”
    name: “Big Timer”
    start: null
    end: null
    dusk: 1256
    dawn: 197
    solarNoon: 726
    sunrise: 241
    sunset: 1211
    night: null
    nightEnd: null
    now: 525
    timer: 0
    duration: null
    onOverride: -1
    offOverride: -1
    _msgid: “df695832.283b88”
    5/28/2018, 9:46:45 AMnode: 45aeb0cc.10082


  153. Hi Pete,

    Long time follower of your blog. I’ve recently installed bigtimer and I can’t seem to get the dusk feature working.

    Here’s an node.error(msg) from output #2:

    {“payload”:0,”reference”:”toSonoff-Dual:sw1-on:sw1-off:791″,”topic”:”status”,”state”:”OFF Override”,”time”:0,”name”:”Porch Lights”,”start”:1200,”end”:240,”dusk”:null,”dawn”:null,”solarNoon”:null,”sunrise”:null,”sunset”:null,”night”:null,”nightEnd”:null,”now”:791,”timer”:0,”duration”:0,”onOverride”:-1,”offOverride”:-1,”_msgid”:”34a10903.608756″}

    The values associated with the “suncalc” module are null. I do have suncalc installed in my home/pi/.node-red/node_modules directory.

    I’ve used node-red for many years and I usually do not have any problems installing and using nodes. In this case, I just don’t know what I’m doing wrong. Any ideas?


    1. Hi

      I’m dealing with a potential issue with night and nightend (which i never usr) but dusk and dawn are working a treat..


  154. Hi Pete,

    I fixed my mistake. I took the latitude and longitude for my location from another program that I use that required them to be specified with a colon instead of a period. (33:40, instead of 33.40)

    I discovered my mistake when writing a quick js program to test the suncalc module.

    Changed to 33.40 and everything work OK.

    Thanks for a great node.


  155. Hi Pete, i want to thank you for sharing your knowledge this way, i seen your blog from time to time, until a few days ago when i decided to start playng with IoT stuff and had to spend a few days inside here 🙂
    I was using cloudmqtt to see a few sensors on my phone, and now with your script i got those sensors being stored for grafana in influx and sending me telegram posts. (HiGrow, esp32 with mongoose) I have yet to see your firmware.

    I have a lot of questions, but i can’t find a clue of some, and here they are:

    1- do you run various instances?
    I i made two projects, one had a flow which send mqtt to influx, and noticed it stopped when i used other projects :\

    2- how do organize your flows and stuff? Do you have a flow full with lots of small flows? im trying to make one flow for alll mqtt, one for all notificattions, etc

    3- do you develop on that same instance and keep restarting all the thing?

    And the final one, because there are no blocks for some ideas…
    I have a node for receiving, evaluating and storing all mqtt, the evaluations (sensor levels) would trigger a template message to another flow via virtual wire to send me a telegram message. but i want an option to request a reading.
    But I do not know how to ask for a new sensor reading from a flow where it could take 5 minutes to get an update from mqtt

    Also: please try to evaluate nginx as a web server for the script, its a lot smaller in memory footprint, very efficient and could do a lot more for you as a frontend for all the stuff 🙂

    1. you can use sub-flows (you can even select a bunch of nodes in a flow and convert them to a sub-flow):

      about nginx, it can be done, sure… a while ago i tested lighttpd and worked well, but we never integrated it… honestly, i’m studying Docker right now and i’d like to port everything to it, instead…

      1. Yep Docker is definitely the way to go for each of the components and then call them in as needed.

        I have just rebuilt a centos server at home – moved all the stuff that i had natively installed previously into prebuilt docker images and it is magic

  156. hi everybody!

    I am planning to use the bigtimer for my pool pump as a simple countdown to turn the pump off after a specific period of time, which I set in the node red dashboard.

    So setting up the bigtimer with “timer 300” for a 5 minute countdown – so far so good.

    But when I also set the timeout property to 5 (which should be 5 minutes) the timer will be canceled after 5 seconds – NOT minutes!

    When using the timer function the timeout value is seen as seconds value, instead of minutes value.

    Did someone experience a similar behaviour? Bug or feature :)?