There’s something wrong with something.
Indulge me:
[{"id":"2e93a8b5.1f22d8","type":"inject","z":"e9882c4e.450a6","name":"","topic":"","payload":"Banana","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":640,"wires":[["920c54cd.f416b"]]},{"id":"920c54cd.f416b","type":"function","z":"e9882c4e.450a6","name":"Fast track","func":"// var msg2 = { payload:\"N/C\" };\nmsg = {payload:\"Payload\", delay:1000};\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":640,"wires":[["b9ea90e8.3238e8"]]},{"id":"8755038.67b138","type":"inject","z":"e9882c4e.450a6","name":"","topic":"","payload":"Banana","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":370,"y":740,"wires":[["2687224f.5a0a9e"]]},{"id":"33b2cea6.90bb22","type":"inject","z":"e9882c4e.450a6","name":"","topic":"delay","payload":"1000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":300,"y":840,"wires":[["e62fa1f0.d7b41","e7efcbb9.3d718","2687224f.5a0a9e"]]},{"id":"2687224f.5a0a9e","type":"function","z":"e9882c4e.450a6","name":"","func":"context.delay_ = msg.topic;\ncontext.msg_ = msg.payload;\n//if (context.msg_ > 0)\nif (msg.payload > 0)\n{\n context.set('delay_',msg.payload);\n node.status({fill:\"yellow\",shape:\"dot\",text:\"value\"});\n return msg.delay;\n}\nelse\n{\n// msg.payload = context.msg_;\n// msg.delay = context.delay_;\n// msg = {payload:msg.payload, delay:msg.delay};\n msg = {payload:context.msg_, delay:context.delay_};\n node.status({fill:\"green\",shape:\"dot\",text:\"message\"});\n return msg;\n}\n","outputs":1,"noerr":0,"x":690,"y":740,"wires":[["b9ea90e8.3238e8","7f916ac2.ae7bcc","eaebfbfa.76676"]]},{"id":"b9ea90e8.3238e8","type":"delay","z":"e9882c4e.450a6","name":"","pauseType":"delayv","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":900,"y":740,"wires":[["522c2349.6c1c3c"]]},{"id":"522c2349.6c1c3c","type":"debug","z":"e9882c4e.450a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1070,"y":740,"wires":[]}]
Press the top “banana” node. That goes through a “fast track” node. This sets the time to 1000 ms.
That goes down to the delay node. That shows 1 second. It works.
Given that it has 1 second now, if you press the delay 1000 button (ok, you will see the yellow indicator activate on the function node) and then the lower “banana” button, you will see the green indicator.
The delay node becomes active, but it is 6 seconds.
Sorry, but that goes against what you said previously:
That should not be the case. Once a delay and value message have been received then each value message should be delayed by the time specified by the latest delay message.
Blank look.
Oh, just to declare:
Yes, I know: in the latter example, the “fast track” makes it 1 second.
Pressing the button marked 1000 (further down) also sets it to 1 second.
But when you press the banana button and it goes through the function node I wrote, it somehow becomes 6 seconds…
Just so it can’t be said I was being silly using the same value twice. Irrispective, with my function block it somehow becomes a 6 second delay.