DELAY node - feature request

As is, the delay node can accept variable delays in the msg.delay part of the message.

All nice.

I've found a place where it falls short:

Say I have it set to rate limit.
It limits the rate but the fixed value I enter.

't would be nice if msg.delay also had control on that part of the node's working.

This is a flow (bit of a mash up) that does what I want, but it is a bit convoluted in getting the job done.

[{"id":"ddfa9b52.558568","type":"change","z":"b4f1ccd4.5e8d1","name":"","rules":[{"t":"set","p":"delay","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":1580,"wires":[[]]},{"id":"e8522a1f.4c89b8","type":"inject","z":"b4f1ccd4.5e8d1","name":"","topic":"","payload":"Dummy message","payloadType":"str","repeat":"0.5","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":1730,"wires":[["4aa07069.702ae"]]},{"id":"dd2d9210.f02b","type":"change","z":"b4f1ccd4.5e8d1","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"delay","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":1660,"wires":[["5c3db77e.000528","f688c6c7.32d258"]]},{"id":"25308454.b65f24","type":"inject","z":"b4f1ccd4.5e8d1","name":"","topic":"","payload":"5000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1500,"wires":[["ddfa9b52.558568"]]},{"id":"661b9c82.68d25c","type":"inject","z":"b4f1ccd4.5e8d1","name":"","topic":"","payload":"8000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1540,"wires":[["ddfa9b52.558568"]]},{"id":"1857a94c.3c856f","type":"inject","z":"b4f1ccd4.5e8d1","name":"","topic":"","payload":"2000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1460,"wires":[["ddfa9b52.558568"]]},{"id":"c7221256.3f9b48","type":"inject","z":"b4f1ccd4.5e8d1","name":"","topic":"","payload":"200","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1420,"wires":[["ddfa9b52.558568"]]},{"id":"4aa07069.702ae","type":"function","z":"b4f1ccd4.5e8d1","name":"One only V2","func":"var full = context.get(\"FULL\") || 0;\nif (msg.topic == \"GATE\")\n{\n    //\n    if (msg.payload == \"FULL\")\n    {\n        //  Allow all messages\n        context.set(\"FULL\", 1);\n        context.set(\"ALLOW\",1);\n        node.status({fill: \"green\",text:\"FULL\"});\n        return;\n    } else\n    if (msg.payload == \"CLOSE\")\n    {\n        //  Stop messages\n        context.set(\"FULL\", 0);\n        context.set(\"ALLOW\",0);\n        node.status({});\n        return;\n    } else\n    //\n    {\n        context.set(\"ALLOW\",1);\n        node.status({fill: \"green\",text:\"ONE\"});\n        return;\n    }\n}\nif (context.get(\"ALLOW\") == 1)\n{\n    //\n    if (full == 0)\n    {\n        context.set(\"ALLOW\",0);\n        node.status({});\n        return msg;\n    } else\n    return msg;\n}\n\n","outputs":1,"noerr":0,"x":360,"y":1730,"wires":[["dd2d9210.f02b","5dd92347.e5d984"]]},{"id":"5dd92347.e5d984","type":"debug","z":"b4f1ccd4.5e8d1","name":"OUTPUT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":1730,"wires":[]},{"id":"5c3db77e.000528","type":"delay","z":"b4f1ccd4.5e8d1","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":420,"y":1660,"wires":[["7ea55c15.2ef5e4"]]},{"id":"7ea55c15.2ef5e4","type":"change","z":"b4f1ccd4.5e8d1","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"GATE","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"ONE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":1660,"wires":[["4aa07069.702ae","148e1988.c1e116"]]},{"id":"ce21a708.c723a","type":"inject","z":"b4f1ccd4.5e8d1","name":"Start up","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":550,"y":1610,"wires":[["7ea55c15.2ef5e4"]]}]

JFI see here for previous discussion on it

1 Like

I did get something like that but a bit smaller.

But gee it was messy.

And I am still not 100% sure it did/would work.

I'll look now.

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