Calculate average value of sensors

191234575_3353365744889886_702907418113150176_n

Are you wanting to only average the values in that one payload? Or are you going to be wanting to average the values of multiple payloads and each one of those occurrences would be averaged?

I'm wanting to average the values of four sensors of for a NODE and each one of those calculations occurrences would be averaged. thank you.

I'm assuming that you want the average value of the 4 vales in your screenshot above.
(probe1 + probe2 + probe3 + probe4) / 4 is that correct?
If so, try this in a function node;

const val = Object.values(msg.payload[0])
function calculate(array) {
    return array.reduce((a, b) => a + b) / array.length;
}
msg.payload = calculate(val)
return msg;

If you mean something different, you will need to provide a better explanation, in more detail.

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