If I have an automation, script, group, etc. that references an entity_id that doesn’t exist, WTH can’t Home Assistant notify me of that? I make changes relatively frequently and often run into situations where I’ll change or delete entity_ids that are referenced in groups, automations, scripts, or lovelace YAML defintions (views or cards). It would be a giant help to have Home Assistant do two things:
When deleting or renaming an object, tell me where it’s referenced so I can update the references
At startup, run a quick routine to find “orphaned” entity_id references where a script, automation, etc. is looking for an entity_id that doesn’t exist. Report what it finds as an alert / error.
As I think about it more, I’m going to attempt to write a little validation engine as I described in item 2 above. It should be fairly simple to parse the YAML files in the config directory and validate each entity_id referenced against the current list in “Home Assistant.” For any entity_id that exists in the YAML but not in the Home Assistant, it can report an error or send a notification of some kind.
Ideally, the system would do this itself and would provide feedback at the time of the change that caused the entity_id to be “orphaned.”
You should use the visual studio code addon, it does this for you already. As for the errors, you’ll get them when the automation/script is executed (unless you use visual studio code addon, then it tells you as you code).
I’m using vs_code, but the IntelliSense only autocompletes for you when you’re editing an automation, etc.
An example of the issue I’m talking about would be that today I went and renamed the 6 Tuya bulbs in my kitchen from light.kitchenx to light.kitchen_x. It would be really cool if HASS could tell me all of the places where I had an orphaned reference so I could go fix them.
In vs_code, I can go and run a search for each of the names, but I have to remember to do that. It would be cool if HASS could tip me off that there are problems in the YAML.
Also, I’ve not seen it throw an error / alert when an entity_id is referenced. It seems like the automation just fails. No? I’ll run a couple tests to confirm.