Energy dashboard, long term history recording

Since my home assistant is running on a RPi 4, it is operating 24. The first system I used was a synology nas which shut down at 10:30 and startup at 7:00 in the morning.

Because of the 24h operating time HA will purge my DB (about 3.2GB of data)at 4:12, and sadly get corrupted which result in loss of my long time history.

Maybe it is a solution only to record my energy dashboard (for me most valuable, long term data) in de DB with include option.

But I don’t have any clue which domain, entity to include? Any help needed!

I am also considering to use MariaDB, but because a am a noob, I don’t know how to transfer the long term (energy dashboard) history to mariaDB.

There is no provision for this. You will have to start recording again from nothing after installing MariaDB.

Ok, so there isn’t any change to export or migrate sqlite3 database to mariaDB?

Can you tell me which entities, or domain or whatever I have to include in de recorder?

You dont have to include anything. All entities are included by default.

i saw this the other day, have not tried as i deleted marieDB integration before i started using it, eventually i would like an “external” on “additional” samba-share if possible

ohh looks like the same as above :slight_smile:

Thanks for the information! I will give it a try and will let you know the outcome.

My HA energy is already storing its data to MariaDB. Is it still possible to insert ‘old’ data in a running DB?

Short answer: Yes … But now you are “complicating it” :wink:

…if the script “Create / Alter / Drop / Delete” are not in conflict with present DB configuration :slight_smile:

  1. Make sure you use same DB_Name as current -in HA
  2. Same User-Name /Passwd
    3 Make Backup, on both “sites”
    ( Above makes life easier)

If Anything in the script is set to , Create/ Alter / Drop anything that this is present in MarieDB … guess what :wink:
If you already created a DB in MarieDB( Calling it the same as your current DB(home-assistant_v2.db) in, and HA is using this now for “Energy”, you are on thin ice …

So in short it depends on what you named your DB( in MariaDB), which Tables are already in existing(in Maria DB), and whether the script is written to Drop existing, and Creating New

And a “Normal” procedure for such a “big” task is to “stop db”, before export, stop db “when import”

You can use either of above( or in script) Queries on a running DB, but in import … But

As mention i’ve never perform such a task on a mariaDB, thou back in time on Oracle … and yes obviously, you will “loose” data ( from point in time-to point in time) , unless you perform a “Running Replication, and switch over” Which i doubt can be done in this scenario

PS: The solution (transfer old data), can be done, from a mariadb>mariadb with " insert into table ", … which i don’t see, and not are normal when you perform a migration like in the other “Topic”

Last but not least: As Toml mentioned, your longterm statistic will be your next “consern” :slight_smile:

I would have/will eventually: Create MariaDB, on a “Mounted” mSate ( Have 2st 128GB in my laptop, only dedicated half/60GB to VM(Ha) partition on 1, so i was thinking( have partitioned the other, in 2 partitioned of 60 gb as well ) using 1 for files, 1 for comming DB ) … Creating 2 external MarieDB( and not starting using them before i plan to do a migration, if something goes wrong i immediate have the other available, to “try again” :laughing: ), then do the migration, switch over, i dont mind loosing a days/data if it comes to that, the other DB i will use for other “purposes”, but also as a “Slave” replicating some “longterm” data( defined by me )

Edit: Actually the last proposed solution in above url, do use the running “partial insert” , i would go for that … what could go wrong ? :grinning_face_with_smiling_eyes:

Hi, thanks again for your answer!

Ik tried but no succes. I will start with a blank MariaDB. Hopefully it will be more stable and won’t give it a corrupted database overnight.