Same here, I’m using Home Assistant for a few years and now my energy provider allows me to download historic energy data as simple CSV files with , e.g.:
I would also like this. I have solar panels since Sep’ 20 and have always monitored them with Shelly’s. I also have a Shelly EM that measures the “Grid Import” / “Grid Export”, so I have all data needed for this.
The Shelly Cloud has the possibility to download all history into a .csv file. This file contains accumulated energy with 10 minute intervals (in my grid Shelly: import and export are separated).
from me!
I am getting my readings (imported & exported energy + gas readings) from my supplier’s Restful API (Octopus Energy).
These readings are for 30 minutes blocks, however they are only available up to a previous day (so effectively they are always delayed by up to a day)
That would be very handy if I could use import these data in Home-Assistant!
Just wanted to note for any interested developers it seems there is a way for an integration to add data in the past to history without changing the current state of entities. It can be done by using async_add_external_statistics:
There are currently two integrations in core making use of this if you’re looking for an example, Demo:
And tibber:
To be clear, this isn’t a solution to this FR. But if anyone is interested in building an integration to contribute to core or make available in HACS which does import of historical data I think it can be done using this API in core without the need to write a lot of custom SQL.
When playing with the demo-integration, it seems that the async_add_external_statistics always creates a new entity and thus it seems to be unable to link the historical data to the already existing sensor entity. As a result, after importing the historical data, you will have two entities (one containing the imported data, one containing the measured-by-HASS-data) which is annoying.
yes, but websocket events api recorder/import_statistics
switches import method based on the id (xyz:something = external, xyz.somehting = existing sensor)
if valid_entity_id(metadata["statistic_id"]):
async_import_statistics(hass, metadata, stats)
else:
async_add_external_statistics(hass, metadata, stats)
I successfully imported external data to an external entity, and can update it. But having some problems with continuity. Only way I was able to have the right charts is to get the sum of the last inserted value and continue inserting increasing sums without ever resetting. The last_rest does not seem to work, at least for yearly energy graph.
Any chance you might do a mildly detailed run through of how you do this? Dominion recently began offering detailed statistics for my area, though there’s no way to hoover them into HA that I can see. I’d love to be able to track them in HA if possible.
I have one part which parses my energy supplier’s Dashboard and stores them in a database.
I then have additional scripts to aggregate and send the data to influxdb or/and home assistant.
For home assistant I aggregate the data to hourly values, since this is the smallest unit supported in the statistics history screen.
It retrieves the last current value for a date and appends the new values by adjusting the sum based on this existing stat. It is the only way I found to have graphs without errors, because any combination of reset with last_reset did not work.
I use long lived access token which can be generated in your profile page in home assistant.
The websocket api can be used to add data to existing entites you must use the “type.name” syntaxe instead of “external:name”. But you might get problems with sum changes between imported data and the one already inserted.