Energy Dashboard - keep getting 1 spike every midnight

I have had multiple posts in the past (long time ago) but never managed to solve this issue. I have searched but could not find a better place than to start with a fresh topic to ask for help.

I have this crazy spike in the energy dashboard every night:

The sensor gives clean data:

The other day:

Where do I need to start troubleshooting this issue?

Ok so looks like your solar energy sensor resets to 0 at midnight, but HA is seeing it as energy usage by solar.

That means that HA is not aware of this midnignt reset and you need to create a utility meter helper using this sensor and set the cycle to daily. Then use this utility meter in your energy dashboard.

Will try thanks

The utility meter will fix it, but the actual problem can also be fixed in the sensor itself by making sure the state_class is total_increasing and not total. With state class total a drop in the value is seen as production, with total_increasing it is seen as a meter reset. Utility meters have the right state_class, so that is why you can use it too.