Save and restore energy data

Hello all, very quick question: what’s the proper way to save and restore the energy data. I messed up my home assistant and need to start over. I can reconfigure everything easily but the only thing I really want to save is the energy consumtion data. When I hit the button download data in the energy tab, it’s downloading data corresponding to the current view only…

NB: I tried to find home-assistant_v2.db but I don’t see it in Studio Code Server, within the config folder

That’s strange to me. I’m not an advance user and can’t remember doing anything specific with the DB (ie. I didn’t try to convert to MariaDB)

Thanks all!

You can use the history tab but… I am not sure if you have thought this trhough enough. How are you going to re-import it, adding it to a new (statistic) entity? I mean …it is feasible in multiple ways but not ‘easy’ at all.

EDIT: alternatives:

  • write a python script to use the API
  • use the SQLite db browser and export the table

I did think about it, that’s why the question is about both the export and import :slight_smile:

Fortunately, I’ve been able to fix my Home Assistant and don’t need to do that anymore. It would be great to have an option to export/import energy data built in Home Assistant though.

There is not much, Spook has an import service call but tbh I have not tested it against an existing entity. I myself have a integration in which I use the webservices by HA directly (which Spook also uses) but this too does not use an existing stats entity. . I have been thinking on providing a custom component for this (CRUD) but have not found the time yet (no prio)