Correct.
On boot I send messages into a subflow which "handles" that stuff and sends them in the correct order to the chart
.
But what is rubbing me is that the machine is on. 24/7. I turn on the machine and look at the web page.
The colours are reversed.
But either from refreshing the screen (which I didn't do this time) or... something else (unknown) they swapped back to how I want them.
How?
This is an exert from the flow:
[{"id":"80b0e258.e7dc5","type":"subflow","name":"Chart driver","info":"","category":"","in":[{"x":160,"y":320,"wires":[{"id":"db06f960.5e9f18"}]}],"out":[{"x":1210,"y":210,"wires":[{"id":"83acadaa.7477","port":0}]},{"x":1210,"y":260,"wires":[{"id":"2544e7e2.f745a8","port":0}]},{"x":1210,"y":310,"wires":[{"id":"90809ac2.c19238","port":0}]},{"x":1210,"y":370,"wires":[{"id":"92bb3e42.869668","port":0}]},{"x":1210,"y":420,"wires":[{"id":"556a442b.6e6464","port":0}]},{"x":1210,"y":470,"wires":[{"id":"2544e7e2.f745a8","port":0}]}],"env":[],"color":"#3FADB5","outputLabels":["VCGen output","Temperature GAUGE output","Chart output","CPU load output","MQTT CPU load output","MQTT Temperature output"],"icon":"node-red-dashboard/ui_chart.png","status":{"x":1210,"y":520,"wires":[{"id":"27bc13e8.c5530c","port":0}]}},{"id":"92bb3e42.869668","type":"cpu","z":"80b0e258.e7dc5","name":"","msgCore":false,"msgOverall":true,"msgArray":false,"msgTemp":false,"x":500,"y":371,"wires":[["556a442b.6e6464","39e1390e.286e1e"]]},{"id":"556a442b.6e6464","type":"function","z":"80b0e258.e7dc5","name":"Set TOPIC","func":"msg.topic=global.get('myDeviceName');\nmsg.topic =\"STATUS/\" + msg.topic;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":420,"wires":[[]]},{"id":"2544e7e2.f745a8","type":"function","z":"80b0e258.e7dc5","name":"Make number and set Topic","func":"//msg.payload = Number(msg.payload)/10;\nmsg.topic=global.get('myDeviceName');\nmsg.topic =\"TEMPERATURE/\" + msg.topic;\nreturn msg;\n","outputs":1,"noerr":0,"x":590,"y":260,"wires":[["747e572.fa24628"]]},{"id":"83acadaa.7477","type":"vcgencmd","z":"80b0e258.e7dc5","name":"Check Temp","command":"measure_temp","codec":"H264","clock":"core","voltage":"core","memory":"arm","videoOutput":"0","separateMsg":false,"x":500,"y":210,"wires":[["2544e7e2.f745a8"]]},{"id":"39e1390e.286e1e","type":"delay","z":"80b0e258.e7dc5","name":"Delay","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":660,"y":350,"wires":[["5e757639.3b333"]]},{"id":"747e572.fa24628","type":"change","z":"80b0e258.e7dc5","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Temperature","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":775,"y":310,"wires":[["90809ac2.c19238"]],"l":false},{"id":"db06f960.5e9f18","type":"switch","z":"80b0e258.e7dc5","name":"Route messages","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"BOOT SIGNAL","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":320,"wires":[["90809ac2.c19238"],["83acadaa.7477","92bb3e42.869668"]]},{"id":"27bc13e8.c5530c","type":"status","z":"80b0e258.e7dc5","name":"","scope":["90809ac2.c19238"],"x":730,"y":520,"wires":[[]]},{"id":"90809ac2.c19238","type":"function","z":"80b0e258.e7dc5","name":"Work on this node","func":"var x = msg.payload;\nif (msg.payload == \"BOOT SIGNAL\")\n{\n context.set(\"BOOTED\",1);\n node.status({text:\"Reboot singal received\"});\n msg.payload = [ ];\n return msg;\n}\nvar booted = context.get(\"BOOTED\") || 0;\nif (booted == 1)\n{\n //\n // booted flag set.\n if (msg.topic == \"Temperature\")\n {\n // The correct message has now been received.\n context.set(\"BOOTED\",0);\n return msg;\n }\n node.status({text:\"Trying to wipe graph\"});\n // HEARTBEAT message received.\n// context.set(\"BOOTED\",2);\n //\n msg.payload = [ ];\n}\nelse\nnode.status({text:\"\"});\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":910,"y":330,"wires":[[]]},{"id":"5e757639.3b333","type":"change","z":"80b0e258.e7dc5","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Load","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":775,"y":350,"wires":[["90809ac2.c19238"]],"l":false},{"id":"d7cd04be.ae933","type":"subflow:80b0e258.e7dc5","z":"9b7e7466.a4b698","name":"","env":[],"x":1350,"y":330,"wires":[["4033a7bc.8a48a"],["6cdb7a0f.bfd02c","d2dc44ff.435c2"],["19cb42a6.97bbb5","c60cd4ee.63cab"],["8e629d11.9c4bf","eb757cb4.300a3","f25cd495.71722"],["56ad688.9089898"],["a6924ea0.caa7e"]]},{"id":"19cb42a6.97bbb5","type":"ui_chart","z":"9b7e7466.a4b698","name":"","group":"b91547a3.789ea","order":7,"width":"5","height":"5","label":"History","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Comms","dot":false,"ymin":"","ymax":"","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#ff0000","#000000","#ff7f0e","#2ca02c","#98df8a","#bf7878","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1570,"y":310,"wires":[["8dcc7198.fe5b8","56362ac8.333c04"]]},{"id":"b91547a3.789ea","type":"ui_group","z":"9b7e7466.a4b698","name":"TelePi Telemerty","tab":"3245f51f.065aba","order":1,"disp":true,"width":"7","collapse":false},{"id":"3245f51f.065aba","type":"ui_tab","name":"TelePi Telemetry","icon":"track_changes","order":1,"disabled":false,"hidden":false}]
There is a boot
signal send in at start to make sure the chart
is clear.
Then the messages arrive - at about the same time and are sequenced before being sent to the chart
node.
So how can the colours swap when I load the page on another machine?
(then swap back with no control input from me.)