Not enough here to say exactly what’s going on, but we can make a few changes and see what happens.
I’m interested in how the first Graph+ was generated because the period is set to “today”, yet the Start date is Yesterday at 4pm. So it covers about 21 hours. The average Watts is 1.09 so 1.09x21=22.89. The graph has it at 23.0 kWh. So I thing the 23 is right for Yesterday at 4pm through Today at 1:04pm.
kWh are just the integration of Watts, that is to say Watts over time. The metrics are different because you are plotting the Wh for each 2 minute interval. The plot covers 1261 minutes at 2 minute intervals, so that’s 630.5 intervals. The average interval Wh is 36.4. 36.4x630.5=22,950 Wh or 22.95 kWh. Again, there is some rounding difference, but basically the same number as the integration of Watts.
The last Graph+ is actually totay (through 1:21pm) I could go through the same math as above but trust me when I say that 12.9 kWh is the correct number, and that’s the easiest way to get it. There is a way to get it with more decimal places, but it won’t be significantly different.
Now what’s going on with influx Grafana?
There are a couple of different ways to get kWh from influx. One is to do what you are doing - upload the kWh for each interval and then add them up. The other is to have influx integrate the Watts the way Graph+ does.
Lets look at what you are currently doing and getting a low result. When you upload kWh to influx, you are uploading the individual kWh used every 10 seconds. In the first Graph+ where you are plotting the Wh for each 2 minute interval, the average is 36.4 Wh every 2 minutes. That would be 3.0333333 Wh every 10 seconds. But you are uploading kWh, so the number would be .0030333. You may be losing some precision here. What I would recommend is uploading Wh instead and change the units in Grafana to Wh. Grafana is smart enough to display kWh when the number gets large enough.
To use the second method, integrating Watts, use the integrate aggregation:
Note that I don’t organize my influx database the same way that you do, so the selection of “total_power” is a little different, but you have that figured out. The important thing is to select “Mains”, use the integral aggregation, and then divide the result by 3600 to convert Watt-Seconds to Watt-Hours.
Actually this is more like what you were looking for:
And to reconcile: