Add historic data to Energy dashboard

******* EDIT: this seems older, so vote their too.*******

I see many ask for features to include data from the energy providers, like f.ex. Green Button Project, but also other local or national providers with same offerings of data.
The issue with these data is that they are not live, but delayed with typical 24 hours.

Instead of adding all these providers, then I would like a feature to add historic data to the energy dashboard, so when we can get our hands on those data, then we can add them for yesterday or whatever day they are related to.

Cosign for this. My water provider gives me a daily dump of 24 lines, each with the consumption for that hour.

3 Likes

Considering creating a custom integration to do this. Would need help with sample data and expected outcomes

1 Like

Duplicate of Import old energy readings for use in energy dashboard

1 Like

I just stumbled on Spook by Frenck.
The description of service calls look quite interesting.

@WallyR
I created a script that can do that for the Dutch energy provider Eneco with their Toon thermostat.
The script should be easily adaptable for other providers that use a different export format. The processing logic to change the statistics stays the same.

Just wrote an flow to get hourly data from my energy provider with almost a week shift :frowning: But don’t have an idea how to push to home assistant.

Another scenario this could help with is when the source sensors for grid import and export remain the same, but new variants of them are needed for accuracy.

e.g. I’m using Powerwalls as my source sensors, but my energy provider added PEAK and OFFPEAK rates after the system was installed. I manually created PEAK and OFFPEAK variants of the sensors since I want the Energy Dashboard to show me all recent data accurtely for estimated charges, but that comes at the cost of losing all historical data since those sensors were created AFTER the source sensors.

Rather than messing with importing data via SQL (which I would prefer not to mess up), it’d be great if the Energy Dashboard could just add source sensors with time constraints. e.g. Look at the source sensor ONLY up until X timestamp. This would be especially helpful since it wouldn’t duplicate data since the source sensor is not going away in my case.

2 Likes

FYI, I posted some reasonably robust Python code to insert backdated state data into the states table. The source can be either a CSV file or a SQLite db – with 2 columns (one for timestamp in UTC, other for data to be entered)

https://community.home-assistant.io/t/enter-delayed-aka-backdated-mqtt-data-asynchronously-based-on-attached-timestamp /750485/7?u=puterboy

2 Likes

I have marked puterboy’s post as a solution to make it clear for people searching the topic that there are solutions.
Lasoul have one too, so there is some to choose from.
Thanks to all the ones that contributed! :smiley: :smiley: :smiley:

Thanks.
See the following link for updated version that also adds the corresponding statistics to the statistics and short_term_statistics tables.