#Discussion on adding historical data

1 messages · Page 1 of 1 (latest)

mystic walrus
#

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?

lofty spindle
mystic walrus
#

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

lofty spindle
mystic walrus
#

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.

signal mirage
#

did this work?

#

i want to add some historical data from my past electric bills

timber mist
mystic walrus
# signal mirage did this work?

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.

mystic walrus
scenic igloo
mystic walrus
#

Are you referring to the statistics tab in the developer page?

scenic igloo
#

Yes

signal mirage
#

If i go to a day where theres no data... there no way to change or add anything

scenic igloo
#

Yes that dialog is not intended for adding datapoints. You have to manually edit the DB for that (or use the aforementioned custom integrations)

mystic walrus
# scenic igloo That ought to be fixable with just a one-time `Adjust Sum` though?

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.

scenic igloo
#

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.

signal mirage
#

how exactly do I add it..
i added it and it seems i did it wrong..

scenic igloo
#

And what is wrong?

signal mirage
#

i dont see it anywhere so i can use it

#

there should be a UI

scenic igloo
#

It looks like it exposes a service

#

Try developer-tools/actions

#

look for it

signal mirage
#

ah ok.. thanks

signal mirage
#

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?)

scenic igloo
#

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.

signal mirage
#

Would i need to add that to the grid config?