Finding entity names that have changed

So, I’m curious. How do folks go about finding hard-coded entity names in their configurations that have changed or are no longer valid?

I renamed several sensors and then an automation broke because it was iterating the entity names in a group, but those names were no longer valid, so the automation didn’t work. Worse, because the entity names were in a group, when I inspected the automation it was “valid”, until I realized what had happened. But the same thing could happen if you just delete an entity. How would you know all of the places it was being referenced that you now have to go clean up?

1 Like

I use Notepad++ as my text editor and I just tell ikt to search all files in my (backup) config directory. It outputs a list of matches and I go thru the list and edit the code.

2 Likes

I suppose the real question is how do you do your documentation - and do you even bother?

I use Evernote, which has the advantage of being cloud-based with apps for a variety of devices. You can include images and link notes, so after a couple of years I’ve ended up with a private website. Like all documentation, though, you have to keep on it.

For a more structured approach, an alternative might be a Github project with a Wiki. I did have a look at the Bookstack add-on, but the problem there is that it’s part of HA, so if anything goes wrong, you’re stuffed.

Thanks for the responses. I was looking for an automated way to notify me that I had “unknown” / “changed” entity names. I understand that I could document my installation and if I knew that something had changed I could search for it and make additional updates. Just looking for a way that an automation, script, Node Red sequence, template, etc. could flag a notification and say: “Hey I’m supposed to operate on X, but X no longer exists!”

The issue is that when I consciously change an entity name, I can go and search and update, but if one or more are missed due to poor documentation, the only way you’ll find them is when you notice that something else is broken.