Spikes in energy dashboard due to missing input data?

Hi !
I have a similar problem of “wrong data” showed in the energy dashboard. Due to a WiFi problem the data of my smart meter was not received by HA for about 50h.

As a result I have an invalid spike for the day the smart meter data became available again for HA. And due to the scaling for the wrong values the valid data is not visible.

I’v tried to fix that by looking into the statistic data for both input values (power import/export).
But for both I can not see any invalid values. But during that 50h gap the dialog box show “No statistics found for this period.” and before or after the gap all values seems to be valid.

valid data after the gap (10am)

Any hints how to fix that ???

Just checked in energy dashboard input data on my influxDB:

=> there are no zero values and the values are stricktly increasing

FYI in case you have a similar problem:

It turned out that in the MariaDB tables of statistics and statistics_short_term the sum field was coruppted. The sum value after the measurement gap jumps to a negative value!

After I fixed that the spike is gone.

The scaling has still some issues due to the lack of data during the measurement gap, but is now much more better than before the correction:

1 Like

Seems I have the same issue, but I haven’t got a clue how to fix my MariaDB SQLite tables?

In fact, it’s not quite that simple.

I used the GUI DBeaver for that. But you need to read some small intros / tutorials about the basics. Otherwise you could easily destroy your DB :scream:. Therefore always make a backup of your DB !

to get a rough overview about the steps:

  • stop HA to prevent any write access to the DB while editing

  • find the ID of your statistics of interests in table statistics_meta - in my case the total energy counter to (56) and from (55) the power grid

  • filter the table statistics with that id and find the abnormality in the sum column

  • calculate an offset value which added will result in the correct sum and apply this offset to all following sum entries

  • do the same with the table statistic_short_term (otherwise HA will revert you changes after start :man_facepalming:)

  • apply your changes to each table by the save button on the bottom of the table

  • start HA - and hopefully the energy dashboard is restored

Awesome writeup, thanks!