Sunbum12
(Michael Brashars)
April 14, 2022, 7:37pm
1
Hi!
I was removing some dead devices and entities and I screwed up the end of config.entity_registry
Would someone be so kind as to post like the LAST 5 lines or so, so I can verify my structure?
(No, like a dumbass I didn’t make a backup 1st)
Thanks!
eXtatic
(Dominik 🇩🇪)
April 14, 2022, 7:40pm
2
This is the content after the last entity in core.entity_registry
]
}
}
1 Like
Tinkerer
(aka DubhAd on GitHub)
April 14, 2022, 7:40pm
3
Once you’re up and running, can I suggest you automate taking backups - at least daily, but there’s little reason to not take them more often.
1 Like
Sunbum12
(Michael Brashars)
April 14, 2022, 7:41pm
4
eXtatic:
]
}
}
Hi!
Thanks!
Does the last entry have an ending comma?
Sunbum12
(Michael Brashars)
April 14, 2022, 7:48pm
7
Hi!
I do have the backups, how might I restore one if I can’t set in to the UI?
Thanks in advance!
Sunbum12
(Michael Brashars)
April 14, 2022, 7:53pm
8
I found the backups in the backups directory.
Thanks!
tom_l
April 15, 2022, 12:57am
9
You should set up something that automates your backups and copies them off the SD card. There’s a list of options to do this here:
https://www.home-assistant.io/common-tasks/os/#copying-your-backups-to-another-location
FYI it’s just json. So if you are munging around with it again for whatever reason, just do this before restarting:
cat config.entity_registry | jq
If jq yells at you, you’ve made invalid JSON.
Or even better, don’t edit it by hand and let jq do that for you in rare cases where you do have to mess with it. Like to safely delete an entry for example, you can do this:
cat core.entity_registry \
| jq --arg id 'sensor.stairs_motion_sensor_linkquality' 'del(.data.entities[] | select(.entity_id == $id))' \
> fixed.core.entity_registry
Or to delete everything by an integration (as an example):
cat core.entity_registry \
| jq --arg integration 'nest' 'del(.data.entities[] | select(.platform == $integration))' \
> fixed.core.entity_registry
Can select by whatever you want. Check fixed.core.entity_registry
after if you want and then do mv fixed.core.entity_registry core.entity_registry
when you’re done.
Impossible to screw up the file that way.
Sunbum12
(Michael Brashars)
April 15, 2022, 5:44pm
11
Hi!
Very useful. I will keep this in my notes.
Thank you.
Have a great weekend!
1 Like