Preserve history

Hi,
one of my integrations (Fronius_Modbus) is not maintained anymore but luckily some other developer is now taking care about it. Unfortunately, during the transition to the new fork a lot of entities changed. So now my history is “unlinked”… Can I somehow get that link back, so basically get the data out of the history and add it to the new entities?
THANKS
Thomas

Change the entities back to orig name maybe ?

Not sure if that works… I’m not so deep in the internals of HA. I think there are “internal” IDs and “External” ones and I have no idea what the structure of the Database behind HA is… Maybe someone has the required insights?

entity_id is the key. make it the same and the new one continues with the old data history.

…any chance how I can find out the old ones? This integration has >100 entities, will be some fun to find out and change:-)

And with this you mean ? , in details, how did you “swap” from one to the other Fork, which should be fairly identical, what happend, did you wipe all old entities ?
In that case Revert !, Restore to your “old” install with the backup You “surely” made prior to this transaction, … or some older install/backup … Document all, and then try to Swap to the other Fork in correct manner

What I did is described here: Smooth transition? · callifo/fronius_modbus · Discussion #17 · GitHub. Unfortunately in that fork some of the entities are named differently. I.e. there’s a meter in my configuration, before it was “primary meter”, now it’s just “meter”…
For sure I have a backup from yesterday, but I’m quite hesitant to go that route, sounds for me quite critical… Is there any way that I can look into the database and find out the “old” names?

Yes , if you remember the names, use ie sql-browser

What ?, then why did you make a Backup for ?

EDIT: So if you have that backup-file, Copy it to your i.e windows destop, there you open it with a unzip i.e 7zip … then traverse down to /homeassistant/data, find /.storage, and there you find your old entity.registry file, with the old names

I used SQLLite Web to do a query like this: select * from statistics_meta
WHERE statistic_id LIKE ‘%Fronius%’; This gave me all names, a nice mixture of old and new names. Now I have the IDs for all the entities I’m looking for (with some other searches using the same pattern). I’m thinking about updating the statistics and statistics_short_term table with the new IDs… That would keep my setup clean because I have the new entity names which are really nicer than before…
Am I far off and shouldn’t do that?

I wont give any advises when it comes to edit registry-files or DB’s , just make sure you have a backup , if you fuckup,

NOTE: Just have in mind you are about to tamper with an online single-file DB, which HA recorder has/Should have first prio to, if the DB is in a “Lock” , when recoder want/need to update, HA dump your DB(as corrupted) and creates a new(empty, or with what is has in it’s Wall/shm)

THANKS for your support… Getting late here in Germany, will do that tomorrow… And big THANKS for your note… I’ll take care about that :slight_smile:

You could temporary make an recorder: setting in configuration.yaml
i.e.

recorder:
  include:
    entities:
      - switch.dummy(some entity which doesn't updates)

restart HA
this way you exclude writes to the DB during your “maintenance”

as the “include” will prevent(exclude) everything else than the 1 entity you include