Hi everyone,
With the recent amazing updates to Home Assistant, managing entities and changing their domain via the UI (like using the "Show As" feature to convert a switch to a light) has become incredibly easy.
However, there is still a major pain point when it comes to system maintenance: Broken Automations and Configurations.
Currently, when we change an entity's domain (from switch.my_device to light.my_device) or rename an Entity ID, any hardcoded references in automations, scripts, blueprints, dashboard cards, or Jinja templates are left unchanged. This breaks the logic, and in large smart homes with over 100 devices, finding and manually fixing every reference is tedious and prone to errors.
The Proposal: Dynamic System-Wide Refactoring
I would love to see a built-in "Refactoring" mechanism. When a user renames an Entity ID or changes its domain via "Show As":
- Automations & Scripts: HA should scan and automatically update the
entity_idand, if applicable, upgrade the service call (e.g., changingswitch.turn_ontolight.turn_onif the target domain changed and a generic service wasn't used). - Dashboards: Update card configurations to point to the new entity.
- Templates: A background parser (or a warning prompt) that catches references inside Jinja templates and suggests or applies the fix.
Why this matters:
This would elevate Home Assistant’s user experience to a professional level, making system tweaks entirely bulletproof. It ensures that changing how a device is displayed visually doesn't accidentally break core background logics.
Thanks for considering this!