Orphaned Entity Cleanup Helper Dashboard

Hey everyone! :wave:

I’m still pretty new to Home Assistant scripting, but I was getting really tired of manually cleaning up orphaned entities (somehow ended up with 1,746 of them! :sweat_smile:).

With some help from Claude AI, I managed to put together a dashboard and scripts that make the cleanup process much less tedious. Thought I’d share in case anyone else is in the same boat!

What it does:

  • Batch processing (25 or 50 entities at a time) instead of one-by-one
  • Preview what will be deleted before actually removing anything
  • Progress tracking so you know how much work is left
  • Simple dashboard with buttons for each step

How I use it:

  1. :mag: Scan Enhanced - See what orphaned entities exist
  2. :eyes: Preview Next - Review the next batch safely (no changes made)
  3. :shield: Process 25 + Preview - Safe batch processing with auto-preview
  4. :chart_with_upwards_trend: Progress Report - Monitor cleanup progress
  5. :arrows_counterclockwise: Force Refresh - Sync dashboard if needed

Nothing revolutionary, but it beats clicking through hundreds of individual entities!

Screenshots:

![Dashboard Screenshot]


The preview feature was super helpful - caught a few entities I actually wanted to keep.

:package: Complete Code & Setup:

GitHub Gist with everything: To Gist

The Gist includes:

  • :white_check_mark: All 6 cleanup scripts
  • :white_check_mark: Dashboard YAML (with optional foldable workflow guide)
  • :white_check_mark: Required helpers configuration
  • :white_check_mark: Complete setup instructions
  • :white_check_mark: Prerequisites (Spook integration, optional frontend cards)

Quick Setup:

  1. Install Spook integration via HACS (required for orphaned entity detection)
  2. Add the scripts to your scripts.yaml
  3. Add the helpers to configuration.yaml
  4. Restart HA
  5. Add dashboard to Lovelace

Results:

Successfully cleaned up my 1,746+ orphaned entities with this system. The batch processing made it manageable, and the preview prevented any mistakes.

Optional extras:

The dashboard includes an optional foldable workflow guide if you install fold-entity-row and template-entity-row from HACS Frontend. But it works fine without these too!

Notes:

  • Start with small batches (25) if you’re nervous about the process
  • Use medium batches (50) for faster processing on large cleanups
  • Always preview before processing if you’re unsure about any entities
  • The dashboard shows live progress updates as you work

Still learning YAML scripting myself, so there might be better ways to do some of this. Open to any suggestions for improvements!

Hope someone finds this useful! :hugs:

Credits:

Made with assistance from Claude AI - still figuring out HA automation myself, but this project turned out pretty well!


Update: If you try this out, let me know how it works for you! Always interested in feedback from the community.

1 Like