# Delaying the whole flow

**URL:** https://discourse.nodered.org/t/delaying-the-whole-flow/49776
**Category:** General
**Created:** [16 August 2021 07:54 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776 "2021-08-16T07:54:06Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![subwayfootlong](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/subwayfootlong/32/42037_2.png) [@subwayfootlong](https://discourse.nodered.org/u/subwayfootlong)
#### Post date: [16 August 2021 07:54 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/1 "2021-08-16T07:54:06Z")

</div>

Hello all. noob node-red user here  
Is there a node or a similar function to delay the whole flow for a set period?  
Like in arduino where you can use delay(500) to delay for 500ms?

From what I know the delay node just delays a signal

---

<div class="post-metadata">

### Author: ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)
#### Post date: [16 August 2021 08:14 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/2 "2021-08-16T08:14:23Z")

</div>

Generally the "signal" is the heart of the flow, so a `delay` node does just that... delays the rest of the flows operation, or at least the parts downline from the `delay` node

You might want to supply some context of what your flow does and when/why you want to "delay" it.

---

<div class="post-metadata">

### Author: ![subwayfootlong](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/subwayfootlong/32/42037_2.png) [@subwayfootlong](https://discourse.nodered.org/u/subwayfootlong)
#### Post date: [16 August 2021 09:07 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/3 "2021-08-16T09:07:49Z")

</div>

Ok yeah makes sense.  
So im working on a temperature monitor where if the temperature were to increase above 40 degrees, it would send a notification via telegram. (Users will check room after getting message.)

Iv gotten it all worked out however, my co-worker said I should include an acknowledge function so that they wont get spammed for awhile after knowing about the situation

I thought of using a delay function to achieve this but i dont know how to stop the notification

```auto
[{"id":"43b41c29.f5b1d4","type":"tab","label":"Secure room monitor","disabled":false,"info":""},{"id":"57b0db2e92e4aa07","type":"group","z":"43b41c29.f5b1d4","name":"Testers","style":{"label":true,"fill":"#ffff00","color":"#000000"},"nodes":["c9b2c97358e4d1a8","c69f36d69ce9f4c3"],"x":234,"y":279,"w":232,"h":122},{"id":"6adc9998abd1eecd","type":"group","z":"43b41c29.f5b1d4","name":"Get Temperature","style":{"fill":"#92d04f","label":true,"color":"#000000"},"nodes":["c1483862.60d608","158e94df.0e1dfb","5b043f09.9fef","870ae1dd.e3955"],"x":14,"y":159,"w":912,"h":82},{"id":"ac6588ab2856371e","type":"group","z":"43b41c29.f5b1d4","name":"User input","style":{"label":true,"fill":"#ffC000","color":"#000000"},"nodes":["070c313c2beb7d5c","8e6c837ad4f24882"],"x":14,"y":439,"w":452,"h":82},{"id":"c1483862.60d608","type":"mqtt in","z":"43b41c29.f5b1d4","d":true,"g":"6adc9998abd1eecd","name":"","topic":"TransferFi/SN001-050221/E1:D2:15:10:1F:F1","qos":"0","datatype":"auto","broker":"a2c483a0.4f962","nl":false,"rap":false,"x":210,"y":200,"wires":[["5b043f09.9fef"]]},{"id":"158e94df.0e1dfb","type":"json","z":"43b41c29.f5b1d4","g":"6adc9998abd1eecd","name":"","property":"payload","action":"","pretty":false,"x":630,"y":200,"wires":[["870ae1dd.e3955"]]},{"id":"5b043f09.9fef","type":"change","z":"43b41c29.f5b1d4","g":"6adc9998abd1eecd","name":"JSON Validifier","rules":[{"t":"change","p":"payload","pt":"msg","from":"'","fromt":"str","to":"\"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":200,"wires":[["158e94df.0e1dfb"]]},{"id":"870ae1dd.e3955","type":"change","z":"43b41c29.f5b1d4","g":"6adc9998abd1eecd","name":"Temperature extractor","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":200,"wires":[["74b80a0e06a51436"]]},{"id":"c8b1ae31.94def","type":"telegram sender","z":"43b41c29.f5b1d4","name":"","bot":"d1580cea.43a02","haserroroutput":false,"outputs":1,"x":1150,"y":300,"wires":[[]]},{"id":"c9b2c97358e4d1a8","type":"inject","z":"43b41c29.f5b1d4","g":"57b0db2e92e4aa07","name":"Over Threshold","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"41","payloadType":"str","x":360,"y":320,"wires":[["74b80a0e06a51436"]]},{"id":"c69f36d69ce9f4c3","type":"inject","z":"43b41c29.f5b1d4","g":"57b0db2e92e4aa07","name":"Under Threshold","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"str","x":360,"y":360,"wires":[["74b80a0e06a51436"]]},{"id":"74b80a0e06a51436","type":"switch","z":"43b41c29.f5b1d4","name":"IF Statement","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"40","vt":"str"},{"t":"eq","v":"delay","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":320,"wires":[["fc259d1cb68c52b1"],[]]},{"id":"fc259d1cb68c52b1","type":"function","z":"43b41c29.f5b1d4","name":"Declare Telegram Objects","func":"msg.payload={\n content:\"Secure Room @DCSG above 40!°\",\n type:'message',\n chatId:\n }\nreturn msg;","outputs":1,"noerr":3,"initialize":"","finalize":"","libs":[],"x":850,"y":300,"wires":[["c8b1ae31.94def"]]},{"id":"8f8bdc8214c22b84","type":"debug","z":"43b41c29.f5b1d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":380,"wires":[]},{"id":"070c313c2beb7d5c","type":"telegram receiver","z":"43b41c29.f5b1d4","g":"ac6588ab2856371e","name":"","bot":"d1580cea.43a02","saveDataDir":"","filterCommands":false,"x":130,"y":480,"wires":[["8e6c837ad4f24882"],["8e6c837ad4f24882"]]},{"id":"8e6c837ad4f24882","type":"change","z":"43b41c29.f5b1d4","g":"ac6588ab2856371e","name":"Message Extractor","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.content","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":480,"wires":[["74b80a0e06a51436"]]},{"id":"c4d2edfd4549c125","type":"delay","z":"43b41c29.f5b1d4","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":820,"y":380,"wires":[[]]},{"id":"a2c483a0.4f962","type":"mqtt-broker","name":"TransferFi","broker":"broker.hivemq.com","port":"1883","clientid":"clientId-bCOAHMGS79","usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"d1580cea.43a02","type":"telegram bot","botname":"Bosch_Rexroth_Bot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]

```

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [16 August 2021 09:31 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/4 "2021-08-16T09:31:28Z")

</div>

Have a look at the RBE node (or now the Filter node) this will allow a single message through and then block all the following ones until it is reset.

Craig

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [16 August 2021 09:36 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/5 "2021-08-16T09:36:36Z")

</div>

You could also use the Delay node and click the Rate Limit option.  
 ![Screen Shot 08-16-21 at 10.37 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f76b85d004a1d90aa2eb70f24829b60e546c583b.png)

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [16 August 2021 09:45 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/6 "2021-08-16T09:45:29Z")

</div>

You could also use a trigger node to only allow one message in a certain time, the time can be reset when the switch node outputs on under value.  
e.g.

```auto
[{"id":"74b80a0e06a51436","type":"switch","z":"43b41c29.f5b1d4","name":"IF Statement","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"40","vt":"str"},{"t":"eq","v":"delay","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":320,"wires":[["702c1b81.987fd4"],["fb7cc375.a6c1b8"]]},{"id":"c9b2c97358e4d1a8","type":"inject","z":"43b41c29.f5b1d4","g":"57b0db2e92e4aa07","name":"Over Threshold","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a_unique_identifier","payload":"41","payloadType":"str","x":360,"y":320,"wires":[["74b80a0e06a51436"]]},{"id":"c69f36d69ce9f4c3","type":"inject","z":"43b41c29.f5b1d4","g":"57b0db2e92e4aa07","name":"Under Threshold","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a_unique_identifier","payload":"20","payloadType":"str","x":360,"y":360,"wires":[["74b80a0e06a51436"]]},{"id":"702c1b81.987fd4","type":"trigger","z":"43b41c29.f5b1d4","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"reset","bytopic":"topic","topic":"topic","outputs":1,"x":900,"y":300,"wires":[["fc259d1cb68c52b1"]]},{"id":"fb7cc375.a6c1b8","type":"change","z":"43b41c29.f5b1d4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":340,"wires":[["702c1b81.987fd4"]]},{"id":"fc259d1cb68c52b1","type":"function","z":"43b41c29.f5b1d4","name":"Declare Telegram Objects","func":"msg.payload={\n content:\"Secure Room @DCSG above 40!°\",\n type:'message',\n chatId:12345\n }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1160,"y":300,"wires":[["8f8bdc8214c22b84"]]},{"id":"8f8bdc8214c22b84","type":"debug","z":"43b41c29.f5b1d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":420,"wires":[]}]

```

This example is set to 10 seconds, for testing. Also it may be usefull to have a topic so multiple sensors can use same message sender.

---

<div class="post-metadata">

### Author: ![subwayfootlong](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/subwayfootlong/32/42037_2.png) [@subwayfootlong](https://discourse.nodered.org/u/subwayfootlong)
#### Post date: [16 August 2021 13:10 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/7 "2021-08-16T13:10:22Z")

</div>

This works  
Thanks for the example too.  
You solve my question yet again

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [30 August 2021 13:10 UTC](https://discourse.nodered.org/t/delaying-the-whole-flow/49776/8 "2021-08-30T13:10:54Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
