Calculate energy on Histogram

Good morning everyone,
I have a system that records the instantaneous power (W) on the influxdb database about every 20 seconds. The interval is not accurate, sometimes 21/22, sometimes 18/19… I would like to calculate the Daily energy consumption on a histogram… what is the correct query to use?

The table is called “kwh” and the column “inw”

Thanks!

Flux or InfluxQL? Can you share an example of a regular time series query that you have working, as well as a screenshot of the output over, say, a 15-minute period?

Actually i’m using this query but the results isn’t accurate… I need to find a correct query to fetch a best result

SELECT mean(“mean”)*24 FROM (SELECT mean(“pdc_p1_input_power”) FROM “KWh” WHERE (“pdc_p1_prod_acs” = 0 AND “pdc_p1_defrosting” = 0) AND $timeFilter GROUP BY time(20s) fill(0) tz(‘Europe/Rome’) ) GROUP BY time(1d) fill(0) tz(‘Europe/Rome’)

OK, so before we go straight to the histogram, let’s see if you can get a plain vanilla query in the Time Series visualization like this:

Please give it a try and see if you can get this far.

Yes, i can :smiley:

1 Like

Great. Now what happens when you change the visualization to Histogram?
image

You can also change the bucket size:

1 Like