WTH is there still no option to export/import long term statistics

This is the one missing feature that frustrates me beyond anything

Every time I move/change my HA installation, I lose all long term statistics - right now I use MariaDB on a NAS, so theoretically I could just connect to there again - but it’s not an elegant solution (and takes ages to load). If one link in that flimsy chain breaks, all my energy statistics are lost once agian. I haven’t managed to keep them for more than a couple of months, because somewhere along the line I always change and screw up things and they are un-recoverable…

PLEASE add the option to backup long term statistics separately, so that precious data can be regularly saved and restored if needed, like snapshots.

This was just added…

yeah I saw that - that’s cool and all, but:

  1. I don’t want to donate more personal information to Google (Apple, Facebook, Amazon, Microsoft, etc) than absolutely necessary. So letting them access my energy consumption, which is extremely private data, is an absolute No-Go

  2. I can’t import it again - and I would like to have the long term stuff (especially energy data) integrated into HA forever to be able to compare years of energy data for example.

2 Likes

Yes this is absolutely a must. I already lost my long term stat two times! :frowning:

1 Like

You can use my card here to export your long term statistics (and short term history too) easily as a CSV, without needing Google accounts and such nonsense. It doesn’t do import though (yet).

this looks promising - is there a way to automatically export data, say once a month?

It’s a frontend card that runs in your browser when you open the dashboard. It can’t schedule anything, it’s not something that runs on the backend. That would require a server side custom component.

I’d like to have an import/export function of selected entities long term statistics to be able to transfer the Home Assistant database. I currently have a Maria DB running on my NAS, which was setup way before long term statistics came up. I would like to configure Home Assistant to use its internal DB again, as it is in the meantime also running on a more capable machine with more space (i.e. no SD card).
I do not care about the short term history, but my Energy History should be exported and restored to the new database without to much hassle.

1 Like

There’s a post that describes how to migrate your current DB back to the built in one.