How to cancel delay action

am new to node-red and I want to know how to cancel the action of a delay if it is already activated by sending another msg.
if i send a msg.payload 176 > to the limit it sends a "true" to a delay that if in 10 s it doesn't normalize it sends a 0. i want to stop the delay sending another msg if it normalizes to 176.

[{"id":"988a6253.bc2b5","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"e615f542.6ab088","type":"inject","z":"988a6253.bc2b5","name":"IPC","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"176","payloadType":"num","x":220,"y":160,"wires":[["d1e5c23e.9ef6b"]]},{"id":"2e4db80a.7ac928","type":"delay","z":"988a6253.bc2b5","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":660,"y":200,"wires":[["9b1b73b.b640c9"]]},{"id":"9b1b73b.b640c9","type":"function","z":"988a6253.bc2b5","name":"","func":"if (msg.payload == true){\n \n msg.payload = 0;\n \n} else\n{\n \n msg.payload = 176;\n} \n \n\nreturn msg; \n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":820,"y":260,"wires":[["b31cda3.7080628"]]},{"id":"c76c7c63.a546","type":"inject","z":"988a6253.bc2b5","name":"T140","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"246","payloadType":"num","x":220,"y":260,"wires":[["d1e5c23e.9ef6b"]]},{"id":"d1e5c23e.9ef6b","type":"function","z":"988a6253.bc2b5","name":"","func":"if(msg.payload >= 246 ){\n \n msg.payload = true;\n \n\n}else{\n \n msg.payload = msg.payload\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":200,"wires":[["2e4db80a.7ac928"]]},{"id":"b31cda3.7080628","type":"debug","z":"988a6253.bc2b5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1010,"y":260,"wires":}]

Hi,

Your flow can't be imported.
Please read this how to post your flow.

If you are using the Delay node, this are the options according the help:
reset
If the received message has this property set to any value, all outstanding messages held by the node are cleared without being sent.
flush
If the received message has this property set to any value, all outstanding messages held by the node are sent immediately.

Maybe this can help you.

1 Like

if you served me the msg.reset thank you

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