Custom Integration to import long term statistics from a file like csv or tsv

Yeah, either the existing values and the imported values have to fit perfectly to each other, or you have to reimport everything.

For now, there is not really a simple way. As said, I am working on something, but that will only help if you have correct data after some specific date/time, and import the values before. Everything else will always be “not easy”, I do not even have an idea how to solve this. OK, maybe it could help to import hourly values and calculate the sum from them,

You could provide me a kind of specification containing:

  • what do you have currently in the database
  • which data you would like to import
  • how the result should look like

I cannot promise anyhting, but some input would help :wink:

Thanks man, its not a simple problem cause of the way they are stored.

So I had my DB crash March last year. So any energy data, Solar + Grid (Import + Export) and Battery (Charge + Discharge) is basically missing from Jan 23 to March 23. After is good

I have the data from my solar app and provider. Solar data (Battery inc) is good as it is already hourly. My data from provider is every 30mins but I used a pivot table to make it hourly.

I’m new to home assistant. I wanted to first knowing how to import statistics from an other older system. I struggled a bit with the documentation. Not finding Developer tools / Services.
Would be nice to update the README.md as there is no more service tab:

I thought it wasn’t useful to open an issue on github for that.

I’m succeeded to install this promising custom integration. I had to replace the “custom_components/homeassistant-statistics” mentioned in the readme with “custom_components/import_statistics” to get it working. But the service “import_from_file” is not registered. The UI says that the service should be added manually.
I’m running HA 2024.10 on docker. You can see my folder structure and the integration details below.
Can anyone help?

image

Sorry for that, I’ve found it:

Updated the readme. Thx for the hint!

Updated readme as well. This was wrong since months … thank you!

Regarding the remaining problem, also updated the readme.