Delaying the whole flow

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

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.

1 Like

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

[{"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}]

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

1 Like

You could also use the Delay node and click the Rate Limit option.
Screen Shot 08-16-21 at 10.37 AM

1 Like

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.

[{"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.

1 Like

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

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