Varible times and variable results

#1

Go get a cup of coffee, and try to relax. This is a doozy.

Back back story:
I have one RPI which is my MAIN machine which receives what I can best call telemetry fom the other machines.
If they are compatible, they send Temperature and CPU load.
The time/frequency at which they do this is set "globally" by MQTT messages.

Most of the machines are behaving themselves. The other day when I was updating the NR on them all, one was skipped and I got back to it later.

Then, all the fun began:
It wasn't showing as booted and running NR. Yet I was looking at the NR page and updating it.

(Skipping boring bits)

Seems that one RPI is not playing the game as the others are.

After digging a lot of stuff, I found another problem:
Some of the machines are sending "spurious" pulses which is not consistent in all of them.

Back story to timers:
A while back I asked about how to control the time interval at which a node can spit out a pule - to act as a trigger for things to be done.

I was given this - or something close to it:

[{"id":"e26f2aa9.f6339","type":"inject","z":"98cfac7a.d84cf8","name":"Message","topic":"","payload":"Some value","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":140,"y":180,"wires":[["a6fb78bb.4ceaf"]]},{"id":"a6fb78bb.4ceaf","type":"delay","z":"98cfac7a.d84cf8","name":"Variable delay","pauseType":"delayv","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":410,"y":180,"wires":[["5ad5735.6967a0c","4a65ee46.297318","85835ab0.c4da38"]]},{"id":"ca3c8516.dc744","type":"change","z":"98cfac7a.d84cf8","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":140,"y":230,"wires":[["465fdab3.736b4c","5ad5735.6967a0c"]]},{"id":"5ad5735.6967a0c","type":"function","z":"98cfac7a.d84cf8","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":390,"y":230,"wires":[["a6fb78bb.4ceaf"]]},{"id":"465fdab3.736b4c","type":"debug","z":"98cfac7a.d84cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":290,"y":280,"wires":[]},{"id":"80d357a3.ec6ca","type":"mqtt in","z":"98cfac7a.d84cf8","name":"Scan time","topic":"ALL/SCAN_FREQUENCY","qos":"2","broker":"3d41beed.966452","x":130,"y":280,"wires":[["ca3c8516.dc744"]]},{"id":"3d41beed.966452","type":"mqtt-broker","z":"","name":"","broker":"192.168.0.99","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":"'Music Pi telemetry failure'"}]

Basically it is this (screen shot)

The nodes are orange and you can see the output (from further to the right of the flow which you can't see) but they are at 20 second intervals.
That was set externally via MQTT. By default it is 10 seconds.

Anyway: Reasons aside this is clearly working.

Go to another machine with same debug node active and you get this:

I have done the obvious stuff and copied the nodes from the working to this one.
No difference.

Yeah, ok, you can see other stuff like LOCAL READING ENABLE above/after the part of the flow which is of interest.

That is so I can stop all machines sending their data on the network if I am looking for something else and need the network to be quiet.

I've posted the nodes of interest and not sure what else is needed.

This still hasen't got to the other problem that one of the machines is simply showing the wrong status but I think it is getting too many messages too quickly and so is confused to the state of the machine.

Anyway, anyone know why it isn't always honouring the new time value and sending outputs every (about) 5 seconds on one machine but on another it is doing it at 20 second intervals?

0 Likes

#2

I think I found the problem.

Extra inject node set to cycle on the second screen.

0 Likes