Munged up config.entity_registry. can someone post like the last 5 lines?

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!

This is the content after the last entity in core.entity_registry

        ]
    }
}
1 Like

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

Hi!

Thanks!

Does the last entry have an ending comma?

nope, just the }

Awesome!

Thanks a million

Hi!

I do have the backups, how might I restore one if I can’t set in to the UI?

Thanks in advance!

I found the backups in the backups directory. :slight_smile:

Thanks!

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.

Hi!

Very useful. I will keep this in my notes.

Thank you.

Have a great weekend!

1 Like