Variable delay (again) Yeah, sorry


To start with: Sorry. I don't get what has happened but something is going on.

Back story:
I asked a long time ago about how to make an adjustable frequency output from the delay node.

I looked in my post/question history (what I found) but for some reason, it isn't "working".

To the best of my knowledge it worked way back when - or I thought it did. (No offence to people who helped me.)

Today I was playing with that part of the flow and somehow it all went pear shaped.

I was mucking about on a couple of my machines, trying to optimise a flow. It went yuck and I tried to restore it from another machine.

But when I did that, it remained pear shaped.

This is what I understood is correct/working:

[{"id":"69fbe069.06a548","type":"inject","z":"b804bcf7.e0c1f","name":"Message","topic":"","payload":"Some value","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":190,"y":150,"wires":[["3a440a04.bc6f36"]]},{"id":"3a440a04.bc6f36","type":"delay","z":"b804bcf7.e0c1f","name":"Variable delay","pauseType":"delayv","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":460,"y":200,"wires":[["14af84df.b7e05b","14402e6e.be1bea"]]},{"id":"3ead2422.29e19c","type":"change","z":"b804bcf7.e0c1f","name":"","rules":[{"t":"set","p":"interval","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"interval","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":200,"wires":[["d765bbc4.90476","14af84df.b7e05b"]]},{"id":"870d2af8.d9d718","type":"mqtt in","z":"b804bcf7.e0c1f","name":"Scan time","topic":"ALL/SCAN_FREQUENCY","qos":"2","broker":"bf92ca31.fe7038","x":170,"y":250,"wires":[["3ead2422.29e19c"]]},{"id":"14af84df.b7e05b","type":"function","z":"b804bcf7.e0c1f","name":"Variable repeat time","func":"if (msg.topic === \"interval\") {\n    context.set(\"interval\", msg.payload);\n    msg = null;\n} else {\n    var interval = context.get(\"interval\");\n    if (interval) msg.delay = interval;\n}\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":250,"wires":[["3a440a04.bc6f36"]]},{"id":"bf92ca31.fe7038","type":"mqtt-broker","z":"","name":"","broker":"","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"20","cleansession":true,"birthTopic":"SOM","birthQos":"2","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"EOM","willQos":"0","willRetain":"true","willPayload":"'Camera Pi telemetry failure'"}]

But that part of the flow doesn't quite do what I want now.
Not a big thing, but in trying to get it, the problems started.

What I am wanting is that there is an output to (say for now) a debug node that shows the current delay time.

Ultimately it will go to a text output node. So before it is shown I will put it through a function node to divide the msg.payload by 1000.

I cut/pasted that block of code into the other machine, but for some weird reason:
rather than seeing it change from 10 seconds to (say) 20, I am getting a long pause then a spurt of outputs, which is not wanted.

I'll try working on it myself, but I don't seem to have a base line.



Please start using the Projects feature with git so that when you mess up you can easily get back to the last working version. That will save us all a lot of time.



Hi Colin.

That is a whole other can of worms for me.
(And I live in a place called Australia. Our ADSL speeds are comparable to dial up modems on a good day.)

I have backups locally.

In the mean time I got it working again and the flow is/seems to be behaving itself.

I shall spend some time studying what is going on and try to understand it better.



You might want to read the docs on the project feature.
From the intro:

They are backed by a Git repository,

You can host that Git repository yourself.



Ah, thanks.

I appreciate that. I shall put it on the job list/queue.