Calc heat counter from current power output data with integral

Hi there,
it seems to me I’m too dump to understand integral() function in influxQL.

I’m trying to get my self made heat counter for my heat pump system. In influx I have data about current heat power output in Watts sampled in ~5sec. Which works great so far. But I’m absolutely unable to get an accurate cumulation or summation on a daily base.

IMHO integrating the available samples should be the way to go. But the result of Integral() is always insanely wrong. e.g. 2-3MWh produced in 24h on a warm spring day from a 10kW heat pump.

Is there anyone who could help me to get rid of that?

Attached you will find a sample.csv with date where my heat pump was running for about 34min with a mean output of 4kW, which should resulting around 2,1-2,2 kWh.

Many thanks in advance :slight_smile:

Ok, I think it works now to get out the whole heat count by the following query in Grafana:

SELECT integral("wpOutputW",1h) FROM "calculated" WHERE $timeFilter GROUP BY time(1d) fill(null)  tz('Europe/Vienna')

But if I want to group by wpmode (it’s a tag) to see how many heat takes my house (heat) and how many drink hot water (dhw), the summation of this two results is much higher than without group by tag.

SELECT integral("wpOutputW",1h) FROM "calculated" WHERE $timeFilter GROUP BY time(1d),wpmode fill(null)  tz('Europe/Vienna')

Today ~70kWh without separation versus ~115kWh with group by. The first result with out grouping by seems to be legit.

Am I really the first and only one with this this kind of problem?

Hello @blue_focus,
It looks like there might be some issues with the function:

I’d consider posting in that issue.

Hi @Anaisdg
thanks for your confirmation. I’ll create an issue soon :slight_smile: