HA Prune: Clear up old and stale entities

Hello!

The last few days, I wrote some code to address a problem I have with Home Assistant.

Devices can be renamed outside of Home Assistant. When this happens, the integration does not propagate that change to Home Assistant, i.e., the entity_id is not changed. This makes sense to not break automations etc.

On the other hand, that causes names outside and inside of Home Assistant to diverge over time. See this feature request for concrete user stories.

Unfortunately, Home Assistant lacks a functionality to re-acquire the current names from the integrations.

Some forum ports that are related to the problem:

I appreciate any feedback and comments!

I thought this was an important issue and I am surprised your post has received no replies.

The issue is complicated. For me the important thing is entity_id - a measure (field name) that propagates through the chain:

ESPHome β†’ Home Assistant β†’ Victioria Metrics - Grafana
or
Zigbee2MQTT β†’ MQTT β†’ Home Assistant β†’ MQTT Integration β†’ Victoria Metrics β†’ Grafana
or
SmartThings β†’ Home Assistant β†’ SmartThings Integration β†’ Victoria Metrics β†’ Grafana

Note: Victoria metrics could equally be InfluxDB or some other database, possibly not even a time-series database such as MariaDB.

This is an issue of interoperability and requires agreement at many levels for a unifying protocol.

Matter over Thread was created only through the pressure on commercial interests. It too sought to unify content and delivery mechanism. I doubt there is sufficient will amongst the open-source community to achieve the same.

One can hope!
Ric