I’ve just fixed a startup bug in  my node-red-contrib-timeout node for Node-Red. This is as always, available at also at

The current version then is 1.1.3 which puts out the SAFE message at start-up and starts the default count-down.

Interested viewers will find that as well as the normal msg.payload showing the status, there also exists msg.countdown showing the remaining time in seconds.


You need to activate auto-repeat to use this  (v1.0.8 or later) feature. The node is a simple countdown timer, self-documenting. Here is an extract from the readme file:

‘ After setting the topic and both safe and unsafe messages, for, for example MQTT (or simply putting 1 and 0 into the two messages) the node is triggered by any input and will send the SAFE message out. If continually triggered nothing more will happen but if allowed to timeout, the UNSAFE message will be sent. Hence this can be used as a watchdog. Options include “repeat message every second” and “auto-restart when timed out”. As well as msg.payload showing “Safe”, “Warning” or “Unsafe”, there is also msg.countdown showing the remaining time in seconds.’


See also in the above image a simple function (not related to the timeout node but exceedingly useful anyway) which can show status info including the time and any object property within the Node-Red editing screen (not to be confused with the Dashboard””) – in this case msg.payload and msg.countdown. The function displays time correctly formatted. I recommend putting this in your Node-Red snippet library.

Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = “0” + s;}
return s;
var date=new Date();
var now=Number(date.getHours()).pad(2)+ “:” + Number(date.getMinutes()).pad(2)+”:” + Number(date.getSeconds()).pad(2);
node.status({fill:”blue”,shape:”dot”,text:now + ” ” + msg.topic+”:”+msg.payload + ” ” +  msg.countdown});

See also: node-red-contrib-bigtimer, node-red-contrib-esplogin, node-red-diode


15 thoughts on “Node-Red-Contrib-Timeout

  1. Peter – thanks for this – just wondering is there any reason you tied the countdown output into the auto activate option ? i.e. i can not get countdown without enabling auto activate – i have looked at the JS file and can not see a reason for it – but do not want to copy you work just to enable the countdown output


  2. Great work Peter and thank you. I have been trying to get something similar working but my limited knowledge (still learning @69) of Node-Red programming is nowhere near your standard. This is going to be very useful in several security projects I’m working on.

    Appreciate the efforts you and others are putting into helping the newbies get to grips with Node-Red.

  3. i just installed this node. it seems timer is also triggered on node-red restart (without any input). can you please check ?

  4. Tried with auto-restart, same issue – timeout fired at restart of node-red server (without any input given to node)

    here are versions —

    node-red-contrib-timeout – 1.1.1
    node-red – 0.19.5
    on Ubuntu 18.04.2 LTS (on a regular computer , not raspberry pi)

    1. Yes, Timeout WILL timeout on restart of Node-Red. The input STOPS the timeout. I just attached a default Timeout node to debug and tested this. After 30 seconds it timed out – that is the intended operation.


      1. my mistake.
        here is what I am trying to do — i have a garage door status hooked to node red. I want to start the timer when it gets the message that door is open. and after a set time (let’s say 30 minutes) unless timer is cancelled (by garage close notification) it will send an alert. any thoughts if I could use bigtimer or timeout node for this functionality ?

  5. Hi Peter. Really like the Timeout node but it’s not working quite the way I intend.

    Whenever I deploy a flow It’s starting up in countdown mode, not in Timeout mode. For instance I have a stobe light I want to strobe for 1 day (86400 seconds). Safe payload set to 1 and unsafe to 0. No messages. So just want it to be a toggle input/output. Countdown when it receives 1. Timeout when it receives 0.

    But on deploy it starts it’s countdown at 86400 seconds. Anyway to start it in Timeout mode?


    1. Never mind. I found that I maybe should have been using the Trigger node.

      Out of interest what advantages would your Timeout have over Trigger?

      1. 1.1.4 onwards – you can set the node to unsafe immediately at any time by injecting “unsafe” to the input. Remember also that you can view the current count at any time.

  6. Thanks Peter.
    Still would be cool to have the option to start in Timeout Mode on deploy. For my scenario it would make it a one step process so more convenient.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.