Issue about Array use in another node

Hi All,
I am working on my learning project, And in this project, the sensor gives me 4 values like ... probe 1, probe 2, probe3, probe4. (as underline in image). Now I want to do the total of this value and I need to do other work on it. For, that I need this all sensor value in the new function node. I tried a lot but all gone wrong. So, please anyone has ideas about that please share with me...

Thanks

Hi,

yes .. as you say in your title the data is in an Array. An array of Objects.
We dont know what you tried to do in the 'function' but if you want to access the values of probe1, probe2 etc you can try

let probe1 = msg.payload[0].probe1
let probe2 = msg.payload[0].probe2
let probe3 = msg.payload[0].probe3
let probe4 = msg.payload[0].probe4

let total = probe1 + probe2 + probe3 + probe4

msg.payload = total;
return msg;
1 Like

Thank you sir

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.