Have a look at the section in docs Working with Messages. That will show you how to extract each element and send it to a different guage. You will need to send the array to multiple Change nodes in parallel, each one extracting one element, then pass these on to the dashboard nodes. https://nodered.org/docs/user-guide/messages
Hi Colin, I have read that page from top to bottom 4 times now. It tells me what can be done, but not how to do anything. What prior knowledge is assumed?
Are there any other online resources, with examples that may help me?
I am prepared to learn this for myself but it is a struggle tbh
So you need to split the array and route each element to different flow path.
This is two step operation.
Split
Route
For split there is Split node. Read info page , configure and try. See the output of split node by using debug node with option to see whole msg. You should get series of messages, every message contains a single element of your array in payload and in addition the msg.parts property. This will be used in step 2.
For route there is Switch node. Read info page. As every message contains now parts property , the property msg.parts.index is the one you should then examine to route the message to desired output.
Hi, I have seen and read the info pages. I even think I understand what you are suggesting. However, the debug outputs the same as before. I cannot understand how to configure the split node. I still get the output as an array.
"Array - the message is split into either individual array elements, or arrays of a fixed-length."
I believe I want the former, however, I have no option to do this. Only "fixed length of n" is available.
Attach a debug node (your friend) set to display the 'complete msg object' on the output of the split node. This way you can see what the data is. You probably want to set msg.part to a number.
I am stuck on the switch node of my problem. I am not making any progress at all. My array is split into separate messages. I believe it is a syntax thing that I am not aware of.
Array element 0 to the first output
Array element 1 to the second output
Array element 2 to the third output
Etc.
What comparator do I use, and to what do I compare it to, to generate my outputs as numbers?
I have tried:
== 0
== [0]
..for each option available.
There is no 'element' option, to filter out the array element by its index in the array.
Am I wasting my time trying to do this with the switch node?
If you add a debug node to the output of the split node and display the full msg object, you will see a section called parts if you look in there you will see the number of each part and you could use the variable name in the switch statement.
I created a flow that uses USGS data for a lake dam. It comes in as an array of information, shows on a dashboard with gauges, so this might be useful for you to look at. Here's part of the flow, the entire thing can be downloaded from my Github --> https://github.com/gwgorman/Flows/blob/master/LewisvilleLakeInfo.json
If you go to the github page and mark and copy the complete flow text there then in node-red you should be able to Import it using Import from the hamburger menu.