I am getting data from an electricity current meter where the amps values are coming in as msg.payload: string[7] and kwh as msg.payload: string[6]
the data comes in as one stream of data from my arduino alternating between the two
i want the string[7] values to go to a gauge and the string [6] values to a text item on the dashboard
i am ok with the dashboard itself but i need to know how to direct the streams of data as above please
i have looked at the Switch node which is where i thought it would be quite straight forward but i dont see anything there that is logically the answer
if you know for sure the two different strings are consistently those different lengths, then you can configure a Switch node to check the length of msg.payload using a JSONata expression:
Hi @knolleary Thank you very much for your rapid reply.
Sorry i was not clear enough, the issue is not about the length of text but the fact that the data is in two different array elements called msg.payload : string[6] and msg.payload : string[7]
i want these to go to different dashboard nodes based on which array element it is
i need a nodered function that will recognise which array element it is and direct it accordingly
Do you mean that msg.payload is an array and you want elements 6 and 7? If so then send it down two wires to two Change nodes one configured to Set msg.payload To msg.payload[6] and the other to Set msg.payload To msg.payload[7]. Then send the outputs of the two Change nodes to the dashboard nodes.
Hi @knolleary i think you are right! the string[ ] seems to refer to the length of the string - apologies
What i am getting is in fact string[*] where * = variances depending on string length
I will have to tag my data so i can separate it differenty