Display daily consumption in kWh

Hello, I’m new to Grafana; I’ve installed influxDB and Grafana on my Home Assistant.
I have a sensor measuring the power consumption in my house and an integration sensor that integrates W to calculate Wh.

I have setup an utility meter showing the total Wh and resetting every day at midnight.

I want to use Grafana to create a dashboard where I can easily switch from hourly to daily, weekly or monthly view

By default, Grafana plots a mean but I don’t think that’s what I want
I think what the query should do for each time interval is calculating the difference between the last and the first value in that time interval (as the source sensor only resets daily)


So you record your electricity consumption under InfluxDB and you reset the consumption to 0 at midnight. So you have a few things like this in your database ?

According to your request, you would like to have something like this under Grafana ?

You can easily choose the interval time on Grafana.
To remove the averaging on a curve you just have to remove “mean” under the query.

Can you tell me more so that I can help you.

Kind regards,


That’s exactly what I want

If I want to see day by day as in your example, it’s easy as I think I just have to replace mean with ‘last’ or ‘max’

But how do I switch to a hourly view?
For example if I want it to display the consumption between 5am and 6am the value should be: energy(06:00)-energy(05:00)

In your example the subtraction will make it possible to know the consumption between two points. Two points which must be in the same day otherwise it will not work because you reset to 0 every day.

But you want to show a fixed value in your curve ? If you want to display the consumption between two points, no need to use a curve.

If you want to display your consumption, you just have to remove the averaging in the parameters of the query.

To change the time or date, just change it at the top of the dashboard.

Ok, but how do I perform a subtraction?

I hope my screen will help you, this is an example of subtraction