Energy Dashboard shows false consumption every day right after midnight

I don’t use the UI, but would assume if all the source sensors you are summing have the same device class that should be inherited.

You have three options, ranked best to worst:

  1. Open an issue to report this (you should do this even if you pick one of the options below).
  2. Use YAML to define your template sensor.
  3. Use manual customisation.

ok, looks I dont want to use other sensor, because I will lost 3 years data history from Energy dashboard. Looks I need to open issue on the false consumption after midnight.

Don’t. That will be closed immediately. It is not an issue. The Energy dashboard is functioning as designed. It is your sensors that are reporting the wrong values after midnight.

Pardon me, but how did you came into conclusion, that my sensors that are reporting the wrong values after midnight. Look at the key Today in the JSON.

It is clear that the VERY FIRST message that telemetry sends after midnight is correct. Why dashboard shows nonsense in the first hour after midnight.

{"Time":"2024-07-16T23:59:56","ENERGY":{"TotalStartTime":"2022-06-25T10:13:13","Total":[3711.904,2841.010,2435.306],"Yesterday":[1.040,0.123,0.402],"Today":[1.193,0.124,0.400],"Period":[1,0,0],"Power":[62,5,17],"ApparentPower":[117,12,29],"ReactivePower":[100,10,24],"Factor":[0.53,0.46,0.57],"Frequency":[50,50,49],"Voltage":[235.8,234.6,234.8],"Current":[0.496,0.050,0.123]}}
{"Time":"2024-07-17T00:00:26","ENERGY":{"TotalStartTime":"2022-06-25T10:13:13","Total":[3711.905,2841.010,2435.306],"Yesterday":[1.193,0.124,0.400],"Today":[0.001,0.000,0.000],"Period":[1,0,0],"Power":[62,5,17],"ApparentPower":[119,12,30],"ReactivePower":[102,11,25],"Factor":[0.52,0.45,0.56],"Frequency":[50,50,48],"Voltage":[235.7,234.4,234.5],"Current":[0.506,0.051,0.127]}}

At 0:00 your sensors should be 0, they are not. Or they should continue to increase forever, they do not.

00:00:26 Is not midnight.

OK, then I will try to make a rule at Tasmota side to reset Daily statistic at 23:59:00 and will see if it helps.

That won’t help it will just shift the false consumption to the previous day between 23:00 and midnight.

The cause of this false consumption is not the timing of the reset. A total_increasing sensor can be reset at any point in time and as much as you want. It can all handle that perfectly. for example: I have a sensor that resets when the solar inverter starts every day so today that was 6:47. And that time changes every day based on sun and weather. So forget about the timing.

The problem that we see here is the reset of the sensor is happening in stages. That makes the reset logic think a meter reset has happened multiple times. While in reality it is 1 reset. De reason this happens is because you have a helper that makes the summation of 3 sensors.

So let me try to explain this with an example:
lets say the values of L1, L2, L3 are 0.25 , 0.25 and 0.25
so the value of your sensor is at this point 0.75.
So now the reset needs to happen and the new value of the sensor should be 0.
So when the state of L1, L2, L3 is changed to 0 this happens almost at the same time but not exactly at the same time. So lets say L1 gets updated first. this triggers home assistant to update the sensor of the summation. The new value of the sensor is now 0.50 instead of 0 because the L1 is updated but L2 and L3 are still 0.25. Then the L2 gets set to 0 the summation sensor is again updated and the new value is 0.25. eventually the L3 also gets set to 0 so the new summation value is 0 which is wat we wanted.

So instead of going from 0.75 directly to 0 the real chronological state is:

  1. 0.75
  2. 0.50
  3. 0.25
  4. 0.0

You won’t see this in the history view because it al happen in a timespan of less than one second.
And it is because of these steps you get false consumption. At state number 2 : 0.50 home assistant detects that the meter has had a reset and had already a use of 0.50 since the reset happened and the same happens when the state is 0.25. This is where your consumption is coming from.

So it seams like the sum helper and making the summation of total_increasing sensors is not working like one would expect.

possible solutions:

  • add the L1, L2, L3 to the dashboard as separate counters. To prevent losing history keep the total summation sensor but do not update it anymore with new values. Just remove the phase entities from its configuration

  • Maybe it is possible tot make the total of the phases on the tasmota side?

This is awesome response!

This morning happened exactly what you predicted. Reseting sensor reset at 23:59 screwed up stats in slot before midnight:

And yes, exactly as you say, before I used helper to summarise L1,L2,L3 all worked well.

I will remove Tasmota rule to reset and put L1,L2,L3 as consumption and remove them from Helper. Hope it will work next morning.

Many thanks for great explanation again!

1 Like

Thread can be closed. Following Roeland54 response, removing Helper and adding L1,L2,L3 as consumption directly resolved the issue. Also I kept the old helper sensor added to the dashboard in order not to loose the history.