All energy history disappeared

A few days ago I noticed that all the metrics of the energy dashboard have disappeared (I had at least 3 years of history).
I have an old backup and I wanted to try to recover them: does anyone have an idea of ​​a procedure that I could use?
also trying to put my hand in the DB and copy the data into the correct table.

The fact that it started recording again at 4am, and that no updates were made in the previous days… is very strange

Version: home assistant supervisor 2025.1.2

thanks
Lorenzo

Actual month:

Same problem here. Power usage and Solar production lost older than 20 days.
Any suggestions?

finally I found this post

that allows you to load metrics from a custom service on the DB.
if you look in the latest answers I also put a python script that extracts a metric and prepares it for loading. obviously only those of type energy.