I recently setup my energy import and export to match the time of use tariffs my electricity provider uses.
I have 3 years of usage without separating usage into tariffs. Just kept as " Grid import" or "Grid Export"
My current plan is to copy the data in my MariaDB using SQL, from the " Grid import" and "Grid export" sensors back into the DB with the new metadata_id matching the correct tariff. Then if that's successful remove the " Grid import" and "Grid export" sensors from the Energy Dashboard config.
Any thoughts on pitfalls I may not be aware of? Any experiences anyone can share when they attempted this either this way or with a different strategy?
#Discussion on adding historical data
1 messages · Page 1 of 1 (latest)
look at "spook" on hacs. one of the things it does is add an action for importing historical data to the recorder.
you may be able to query the data you want and process it in the right format to import it.
note: i havent done this myself but its a possible idea to look into...
That looks like it may be a viable option thanks!
Do you know if I can put in large amounts of entries at a time? I have ~62000 rows that need to be created
I am not sure on its limits, even if you have to break it down a bit, it could still be a reliable method
I tried this with the natural gas sensor but need to know the sum of the sensor before and after each update. and the sensors sum will differ from the original once it hits a different tariff.
For a data base, 62000 rows is no problem 🙂
No not for what I need. it doesn't update any entries after you make an insert so for historical data it will show as consumption for the entry that you made then negative consumption back to the running sum the DB uses.
I was referring to the spook capabilities. not the DB itself.
That ought to be fixable with just a one-time Adjust Sum though?
Are you referring to the statistics tab in the developer page?
Yes
If i go to a day where theres no data... there no way to change or add anything
Yes that dialog is not intended for adding datapoints. You have to manually edit the DB for that (or use the aforementioned custom integrations)
I see what your saying. I think that would work if there are no entries in the DB for the time frame you're importing. The trouble I ran into is my gas data has entries hourly already and I go in and back fill with the Adjust Sum like you said. using spook would create a duplicate entry and the sum would alternate between the previous sum and the new sum inserted by spook. then I would have to go back and delete all the old sum entries via the Adjust Sum functionality, Or do it via SQL and if I was going the SQL route then I might as well just write to update the row that is all ready there.
Yeah that would be a mess if it's interleaving new records with old.
I guess ideally the importing tool would be smart about that.
And what is wrong?
ah ok.. thanks
I started adding historical data and it looks like that it messed up recent data...
is there a dummy energy device i can add the data to, so it doesnt mess up the recent data (measured with a shelly 3em?)
Try importing to an external statistic id, e.g. sensor:whatever_you_want_name (note the colon)
statistics don't need to be tied to an entity
I don't know how the support works for externals exactly in that custom integration though.
Would i need to add that to the grid config?