Energy Statistics broken after crash/restart

Hello,

I set up home assistant with a couple of esp home sensors, local tuya, shelly, etc. to get an overview about my PV energy generation and usage.
Yesterday my server did an unexpected reboot (my fault) and after that, I had a couple of sensors (e.g. PV energy) were suddenly showing big negative values, instead of small positive ones. I fixed them via developer settings/statistics and the energy dashboard was looking fine again.
Nevertheless the reason for this is probably still unsolved: When looking at the history of my calculated sensors (energy calculations with left Riemann), I can see that the history shows a drop to 0 after the reboot (e.g. the history of one of my sensors dropped from 57kWh to 0kWh).

So now my questions:
How can I fix this? I couldn’t find out, where this drop is coming from and how to fix it.

Thx,

Stefan