UI to Prune unavailable/missing entities

Over the course of my experimentation and general usage of HASS i’ve collected hundreds of entities that are no longer in use (be it having HASS.Agent misconfigured sensors/commands, duplicate HomeAssistant Android apps or just ESPHome experimentation where sensors have moved from one device to another. I don’t understand why there’s no simple UI to just do a regular cleanup of the entity DB. most important entities should re-appear anyway if i remember correctly.

Simple concept:

This program can help find orphaned items, but it doesn’t automatically delete them, so not sure if it’s quite what you’re looking for.

Thanks. But imagine doing all these by hand lol

-== Watchman Report ==- 

-== Congratulations, all 47 services from your config are available!

-== Missing 47 entity(ies) from 162 found in your config:
+--------------------------------+---------+--------------------------------------------------------------+
| Entity ID                      | State   | Location                                                     |
+--------------------------------+---------+--------------------------------------------------------------+
| switch.windowswol              | missing | configuration.tmp.yaml:11                                    |
| switch.timo_pc_wol             | missing | configuration.tmp.yaml:14                                    |
| switch.pc                      | missing | configuration.tmp.yaml:17                                    |
| light.deckenlampe              | missing | automations.yaml:16,529,536,556,563                          |
| switch.old_ceiling_lamp        | missing | automations.yaml:126                                         |
| switch.smart_ceiling_lamp      | missing | automations.yaml:127,142                                     |
| device_tracker.timo_pc         | missing | automations.yaml:150,173,185,189                             |
| input_boolean.timo_pc          | missing | automations.yaml:204,225,248                                 |
| button.timo_pc_shutdown        | unavail | automations.yaml:238                                         |
| device_tracker.timo_tablet     | unavail | automations.yaml:257,656,667                                 |
| sensor.phone                   | missing | automations.yaml:279,284,285,285,286,286,287,288,289,289     |
| switch.pc_power_plug_socket_1  | missing | automations.yaml:325,338,348                                 |
| sensor.smoke_gas_detector_mq_5 | unavail | automations.yaml:428                                         |
| sensor.smoke_gas_detector_64   | unavail | automations.yaml:438                                         |
| sensor.smoke_gas_detector      | unavail | automations.yaml:448                                         |
| media_player.all_media_players | unavail | automations.yaml:480                                         |
| input_boolean.wakeweekday_     | missing | automations.yaml:631                                         |
| light.led_strip                | missing | scripts.yaml:71,329,349,369,389,404                          |
| light.led_strip_2              | missing | scripts.yaml:72                                              |
| switch.led_strip               | missing | scripts.yaml:123                                             |
| button.timo_pc_hibernate_2     | unknown | scripts.yaml:188                                             |
| button.timo_pc_service_hiberna | unknown | scripts.yaml:189                                             |
| te_2                           |         |                                                              |
| button.timo_pc_hibernate_now_2 | unknown | scripts.yaml:190                                             |
| button.timo_pc_restart         | unavail | scripts.yaml:207                                             |
| button.timo_pc_service_restart | unavail | scripts.yaml:208                                             |
| button.timo_pc_shutdown_now    | unavail | scripts.yaml:220                                             |
| button.timo_pc_service_shutdow | unavail | scripts.yaml:221                                             |
| n                              |         |                                                              |
| button.timo_pc_lock            | unavail | scripts.yaml:272                                             |
| button.timo_pc_logoff          | unavail | scripts.yaml:282                                             |
| button.timo_pc_sleep           | unavail | scripts.yaml:295                                             |
| button.timo_pc_service_sleep   | unavail | scripts.yaml:296                                             |
| light.kitchen                  | missing | scripts.yaml:419                                             |
| input_boolean.led_strip        | missing | scenes.yaml:28,51                                            |
| light.deckenleuchte_2          | missing | scenes.yaml:40                                               |
| sensor.date                    | missing | blueprints/automation/sbyx/wake-up-light-alarm-with-sunrise- |
|                                |         | effect.yaml:117,125,145,154,164,168,176                      |
| sensor.date_time_iso           | missing | blueprints/automation/sbyx/wake-up-light-alarm-with-sunrise- |
|                                |         | effect.yaml:118                                              |
| button.fritz_powerline_1260e_r | unavail | .storage/lovelace:154                                        |
| eboot                          |         |                                                              |
| binary_sensor.remote_ui        | unavail | .storage/lovelace:793                                        |
| button.timo_pc_hibernate_now   | unavail | .storage/lovelace:813                                        |
| media_player.timo_pc           | unavail | .storage/lovelace:870                                        |
| media_player.betty_laptop      | unavail | .storage/lovelace:874                                        |
| sensor.fritz_box_7490_external | missing | .storage/lovelace.timo_pc:74                                 |
| _ip                            |         |                                                              |
| sensor.fritz_box_7490_link_upl | missing | .storage/lovelace.timo_pc:78                                 |
| oad_throughput                 |         |                                                              |
| sensor.fritz_box_7490_link_dow | missing | .storage/lovelace.timo_pc:82                                 |
| nload_throughput               |         |                                                              |
| switch.fritz_box_7490_wi_fi_lh | missing | .storage/lovelace.timo_pc:86                                 |
| switch.fritz_box_7490_wi_fi_lh | missing | .storage/lovelace.timo_pc:91                                 |
| 5                              |         |                                                              |
| switch.fritz_box_7490_wi_fi_lh | missing | .storage/lovelace.timo_pc:96                                 |
| g                              |         |                                                              |
+--------------------------------+---------+--------------------------------------------------------------+

-== Report created on 12 Jan 2023 01:31:42
-== Parsed 87 files in 2.22s., ignored 0 files 
-== Generated in: 0.26s. Validated in: 0.00s.

I don’t have to. I had a similarly sized list from 3-4 years of cruft. Didn’t take that long to clean up.

It’s not as easy as having a “Fix Issue” button like on the Dev Tools Stats page.

What do you do with an unavailable entity in scripts and automations?

Simply deleting the trigger/condition/service could actually break choose conditions, templates etc…

You need to inspect the issue and fix it appropriately yourself.

Nope. 20 charrrr.

That does not remove them from automations, scripts or dashboards though.

You are also assuming that an entity that is “unavailable” is necessarily a redundant entity, which is not true across the board.

(post deleted by author)