Using Integers in Grafana for Energy Consumption

Hi guys,
today I successfully installed influxDB and grafana - working quite well. So I am getting adventurous:
I have a couple of Fibaro Switches and I want to know the daily consumption of the lights or whatever the’re attached to.
They do readout kWh so technically I could just readout the current Value of kwH and reset kwH everyday at midnight.
But isn’t there a fancier way using grafana?
To start with, I could tell grafana to always only use todays Delta and then display that in a bar.
I found a nice tutorial, however that one is for initialstate…
http://support.initialstate.com/knowledgebase/articles/1124554-real-time-expressions-compute-energy-costs
is something like that possible in grafana as well?

Mathematically speaking WH should be the integer of Watts consumed over time. Is there a way of telling grafana to compute that integer and show it for the acual day?

Or is the only way to create a rule as shown here:

Thanks for your help!

You can use INTEGRAL function in recent influxdb implementations (https://docs.influxdata.com/influxdb/v1.4/query_language/functions/#integral)
Another way is to use countinuous query to store the last Wh value

I found out about Integral function. That seems to be very powerful and suitable to my needs. However at this moment it seems to be extremely complicated, so I need to read into that. Maybe someone in this forum already successfully implemented an integral in influxdb/grafana. If so, I would be very delighted to see his/her solution.

I think my InfluxDB Quey would have to look something like this:

SELECT INTEGRAL(value) FROM "plug1_watts" time >= '2018-02-23-18T00:00:00Z' AND time <= now

however it does not return any data in grafana.
Jeez, I feel helpless…

Maybe this helps a little.