# TIme remaining on Trigger node - debug or msg.property

**URL:** <https://discourse.nodered.org/t/time-remaining-on-trigger-node-debug-or-msg-property/343>\
**Category:** Core Development\
**Created:** [24 May 2018 06:03 UTC](https://discourse.nodered.org/t/time-remaining-on-trigger-node-debug-or-msg-property/343 "2018-05-24T06:03:54Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![877](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/877/32/8207_2.png) [@877](https://discourse.nodered.org/u/877)\
**Post date:** [21 May 2019 19:47 UTC](https://discourse.nodered.org/t/time-remaining-on-trigger-node-debug-or-msg-property/343/7 "2019-05-21T19:47:21Z")

</div>

I know this is an old thread, but I just used @Andrei 's flow and it's good for showing the 'running' time of the trigger (thanks).

In my case, I have the trigger set for 2 minutes and "extend delay if new message arrives" is ticked. Evertime the PIR detects motion, the trigger starts again.

It would be good if the function would re-start counting from zero at **every** trigger.

Did anyone find a solution?

 ![28](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/69cdec372b2efb9e48d8d35b339e1129ac27c0e7.png)

This is Andrei's function:

```auto
var counting = function () {
  let counter = flow.get('counter');
  counter += 1;
  node.status({text:counter + " seconds"});
  flow.set('counter',counter);
   return counter;
}

if (msg.payload === "true") {
    flow.set('counter',0);
    node.status({text: "Started.."}); 
    let timer1 = setInterval(counting, 1000);
    flow.set('timer1',timer1);
} else if (msg.payload === "false") {
    node.status({}); // clear the status decoration
    clearInterval(flow.get('timer1')); 
    
}

return msg;

```

---

_[View the full topic](https://discourse.nodered.org/t/time-remaining-on-trigger-node-debug-or-msg-property/343)._
