Energy / Power in Grafana & influxdb

Hi all,

I have a question regarding the presentation of energy sensors in Grafana. In below screenshot I display the solar production for one week, and the solar production in one month.
Remarkably, the sensor for week (look at yesterday) mentions the right production, but when I look at the day state in solar this month, it mentions only 1.5 KWH on the 01/30 iest of this month.

The config for the weekly is as follows:

The config of the monthly is as follows:


Has onyone got a clue ?

Thanks in advance !



Just averaging Power to guesstimate Energy is bound to give strange results…

1 Like

Yeah what you want is:

Screenshot 2022-01-31 at 20-50-48 Grafana – Home Assistant

Integrating power with respect to time gives energy.

Thanks alot Tom,

But when I enter the integral, I got wishfull thinking values :slight_smile:

I make more than 1 MW :slight_smile:

Has it to do with grouping on 1 day ?

The view is set on Last 30 days

TBH I have never used the integral aggregation.

As you want kWh try grouping by 1h.

Also if you are grouping by day you should enter the timezone information or you will cross midnight boundaries with your data.


I want to be able to show per day, like in above chart, the total consumption for 1 day plotted on a month

Just found an example:

Click the pencil icon:


Seems to work, but still, I’m getting results in MW. I used the integral subquery and results are like this:

Where code is:

SELECT SUM("integral") AS sum
From (
    SELECT INTEGRAL("mean", 5m) AS integral
   FROM (
      SELECT mean("value") FROM "W" WHERE ("entity_id" = 'solaredge_current_power') AND $timeFilter GROUP BY time(5m) fill(null)
GROUP BY time(1d)

The values of the current power solaredge are stored in Watt

1 Like

You can select the axis unit under Standard Options:


Hi Tom,

The units are already filed as Kwh, now their displayed as 200 MWh …

Seems like I need to divide by something, but not sure what

That was just an example from my Grafana energy graphs to show you where the setting was.

Try setting it to Wh. Because:

It remains in MWH because of the high figures. One single bar represents between 120 & 150 MWh, which is not the case (of course)

If you have energy sensors this is a lot easier to do with utility meters in Home Assistant. You can then import the sensors into Infludb/grafana and select “max” for the cycle (day/week).

If you don;t have energy sensors you can create them: