Average by unknown numbers of messages and unknown time period

Hi.

I want to make averages for COP´s of my heatpump. Actually I´m sending them every 10 seconds to influxDB, but it´s looking terrible in Grafana.
The problem is, that the consumption time is always different for heating, cooling or hot water.
So I can´t use average, calculator or smooth.
I think the only way is to store the values, knowing the number auf values and make the average of it.
But I don´t know how. Is there a node for it or does somebody know how to write a function ?
Thanks a lot.

With kind regards,
Thorsten

Can you show us some examples of what data you are getting, and explain again why it is difficult to smooth.

I´m getting values for heat consumption and heat production and making the COP with it, for example 600W and 3600W. So the COP is 6. The time for heating up is always different depending on how cold it is.
The heatpump values are retransmitted to MQTT broker every 30s.
If the heat-up time takes 30mins I´ll get 60 messages, if it takes 1hour I´ll get 120 messages and when it´s very cold outside the heat-up time may takes 3hours.

So what do you want to do with those 60 (or however many) values?

I want only one value in InfluxDB/Grafana
You can see, that the heatpump had worked 9 times but now I´m having a lot of data points instead of 9.


I want only one value for each heating-up.

You could use a Join node in Manual Mode, to build and Array containing the values. When the set is complete then send it it msg.complete and it will pass on the array so you can then calculate the average value. That will also clear down the array in the Join node so it will start accumulating them when they arrive.