DELAY node - variable delay not seeming to work

I would like to check this:

The delay node:
delay number Sets the delay, in milliseconds, to be applied to the message. This option only applies if the node is configured to allow the message to override the configured default delay interval.

So with the node set to override delay with msg.delay I'm confused.

I send a msg.delay message with the value of 3000 (3 seconds)

It delays for 20 seconds.

I see the value/message going into the node and it is set.

But once the node is triggered (invoked) it goes back to the 20 seconds as set in the value.

Does the variation of the delay time have to be set at the same time as the input trigger?

Not really clear for me.

When the delay node is configured to allow msg.delay to override the delay value, then each message you pass it must have its delay property set for how long you want that message to be delayed for.


Ok. Can you please help me with this problem?

I need a variable delay where I can set it externally to the node.

Then when a message arrives it is delayed for that time before being sent on.

The only reason for this is so the delay can be set outside the node and varied.

Adjustments would be few and far between.

I'll dig through stuff I have been told before/earlier by others. But this is where I am at with this little project.

I know I have done variable time loops but not a delay for messages.

Use a flow context variable to store the your desired message delay value.

Then use a Change node immediately before the Delay node to set msg.delay to the value of that flow context variable.

This kind of works.

[{"id":"7cae39a3.19f398","type":"join","z":"31b9cb24.a2ede4","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":570,"y":1270,"wires":[["591c155a.73442c"]]},{"id":"d060d696.d6b6c8","type":"function","z":"31b9cb24.a2ede4","name":"","func":"msg.delay = 3500;\nmsg.payload = null;\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":1200,"wires":[["7cae39a3.19f398"]]},{"id":"8e888cf2.03616","type":"inject","z":"31b9cb24.a2ede4","name":"","topic":"","payload":"Message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":1270,"wires":[["7cae39a3.19f398"]]},{"id":"591c155a.73442c","type":"delay","z":"31b9cb24.a2ede4","name":"Cool down time","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":680,"y":1200,"wires":[["9ee9c341.78803"]]},{"id":"e74ea714.3e2db8","type":"inject","z":"31b9cb24.a2ede4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":1200,"wires":[["d060d696.d6b6c8"]]},{"id":"9ee9c341.78803","type":"debug","z":"31b9cb24.a2ede4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":860,"y":1200,"wires":[]}]

Thanks Nick.

Seems I am still very low on the learning curve.

But, hey: I can only go up from here I guess.