I have an ESPHome pulse counter that tracks the flashing light on our house power meter. This works really well! The ESPHome has a sensor.electricity_total_daily that slowly increases throughout the day and then resets at midnight.

I am now trying to visualise our daily power usage in the lovelace UI.

At the moment I’m using the mini-graph-card but I’m not quite sure how to get it to show a single bar per day with the total power used, it’s just showing the gradual increase in usage. Is there some way I can get the graph to show the last measure for each day? Or do I need to create another sensor and update that at midnight each night?

Any help would be appreciated… This is what I have so far…
I have noticed that the chart takes a long time to load as I’m currently trying to show 10 days of usage… Ideally I’d like to show a whole month!

Is there any control over the Min,Avg and Max values that show up above the chart? Would be great of the the Min was the lowest total power for a day and the Avg was a proper average, at the moment it seems to be an average of all the data points not just the “max” of each group by…

UPDATE: i have investigated the whole story and bug over there on github

The whole story starts at the point that the y axis scale does not start in the 0,0 coordinate and therefore mostly the current day is showing just a tiny bar cause that is for the most time of a day the by far smallest bar and that is the new 0 of the y axis.
In my case the 1,6 kWh are represented by the talles bar but the latest is so small cause at 0 am it was tiny at 0,3 kWh … this last one can only start to grow if it surpasses the next lowest and leave that behind … so the red average bar I have plotted is not a scale one.

Here the full explanation why the average suffers from a mistake showing only half of the truth or better the real average is twice as hihg.

PREVIOUS / OLD COMMENT STARTS BELOW

That is sad, cause the min 0 kWh is false and misleading cause every day with a counterreset we will have a minimum of 0 kWh. Would be better to hide that part if it is totaly misleading.

Next issue beyond the Min. figure is the average cause that is simply false cause it seems to use the max and min

I can see here a consumption based on peak 1.6 of about at least 6 days 1,2 kWh + daily 0,33 kWh = 7,533 kWh in 7 days
7,533 Divided by 7 days means about 1,1 kWh and not 0,68 kWh.

For me it looks like a mistake assuming that for the stats only the visible data are used, I mean in this case 7 x 24 hours … and not the full 240.

But the 0,68 kWh by average can not be true in this case cause if the current day needed 0,33 kWh then do me a favor and imagine the doubled height of the 0,33 kWh cause the double height would mean 0,66 kWh and the average is just 0,68 kWh.

Min and Avg have to disappear, only MAX is usefull at least in this case

Done it over there after I had found an explanation.

The average shown currently is just the half of the real average and that is caused most likely by miscalculation the daily average by adding the lowest and max value of the counter.
assuming you had 12 kWh of consumption that would be counted by 6 as average for day 1 … and that will continue will on the following days and therefore you will get just half of the real figure. I had checked the values of each bar in 1 week and the latest day to do the math and realise that it is just the half of the real average.

I guess you have missed the major point: the average figure is completely wrong / useless

I also have observed a different behaviour on last weeks figures at least yesterday regarding the last / current day and that the consumption is somehow extrapolated for the calculation like sunday consumption /18 hours x 24 hours for all the math.

My average looked like calculated based on the past 6 days and the 7th day or better today as an extrapolation at least at 7 pm.
I had done the math that way and it looked like that they had extrapolated the average of today . The result was that the average calculation is just 50% of the real figure and the why is explained in the link below. I had an average of 710 Wh in the display, but the real figure war 1420 Wh for a 7 day period where the 7th day had been extrapolated around 7 pm when I did the math. I have explained that over there on github.

You might have doubts, so please check your own figure above and realize that the average is completely off based on that graph and date you had provided.

Look carefully on your stats then an average of 12,08 is impossible.
Why ?
If max is 42,6 kWh then the first 3 days will show roughly at least 41 kWh days or 123 kWh in total.
Can you tell me how 123 kWh can end in a 12,08 kWh average in a 10 day perioed if you had already used 123 kWh in 3 days ?
Even with 0 kWh consumption the following 7 days you will end up with 123 kWh / 10 days = 12,3 kWh which is bigger than 12,08 kWh shown in your chart.

And therefore the position of average and min is unimportant considering that the average is simply wrong.

I guess you had a 24,16 kWh average instead. The formula for the average is most likely taking each days minium and each days maximum to get a “days average” and then all these 10 daily averages are used to get the overall average.
But that is just the half of the reality cause you can not divide a daily counter by 2 to call that an average … cause you had spent 42,6 kWh at that day and not 21,3 kWh by average.

And the minimum of the 10 days you are looking for is the minimum of the daily consumption figure which itselfs are the max of their daily counter.
And if Sat. 5 was the first day with maximum consumption then thursday would be the day with the lowest consumption - if not the current day back then a monday that was not over - would stay below that thursday figure.

If you wanna do the real math please click on each bar and write the consumption down. You will get 9 figures and then press on todays bar and take that consumption to do the following math: todays consumption so far / hours over x 24
Now sum up the 9 day figures + todays consumption so far / hours over x 24 = total consumption
divide that by 10 (days) and you should get the real daily average which will be twice the amount of what you see in your card being displayed. Did work out for use the whole last week.