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.