Home Assistant projects
All projects

Orphan Entities

Integration + card · Maintenance
v1.7.0 · Nov 11, 2026 HA 2024.12.0+ Archived

Archived. Orphan Entities is now part of System Hub: its repository is no longer updated. Install System Hub instead, which takes over its settings (how to migrate).

Tracks the entities their integration no longer provides, and removes them in bulk.

Removed integrations, renamed devices and old YAML platforms leave entities behind in the registry. Orphan Entities lists them all with the reason, and its card filters, selects and removes them in one go.

Highlights

  • Five reasons, from integration removed to unknown for too long
  • Devices of removed integrations, removed with their entities
  • Orphan devices selected one by one to ignore or remove, or all removed at once
  • Each orphan checked again just before its removal
  • Never during startup, nor during the grace period after it
  • Bulk removal limited to the listed entities, with a confirmation
  • Used by badge listing the automations, scripts, scenes and dashboards still using an entity, and the automations and scripts using a device
  • Ignored integrations and entities
  • Diagnostics of the last scan
  • Card with search, integration and reason filters and selection
  • Mini card by reason, with a detail button showing the full card

Works with

Cards

orphan-entities-cardorphan-entities-mini-card
type: custom:orphan-entities-card

Install

  1. 1Open the repository in the Marketplace with the Add to Marketplace button above, or addgithub.com/juju35/ha-orphan-entities as a custom repository (category Integration).
  2. 2Download it from the Marketplace.
  3. 3Restart Home Assistant and add the integration from Settings → Devices & services.

Documentation

From the README

Features

Features

  • Scan of the entity registry at a set interval (15 minutes by default), and a few seconds after the registry changes
  • Five reasons, from the most to the least certain orphan: Integration removed, Integration not loaded, Not provided, then, for entities still provided, Unavailable and Unknown for longer than a set delay (24 hours by default)
  • Never during startup: nothing is listed while Home Assistant starts, nor during the grace period after it has started (10 minutes by default), while the integrations set up their entities. The card then says when the first scan is due; Scan now does not wait for it
  • Bulk removal from the entity registry, limited to the listed entities, with a confirmation. Each entity is checked again just before: one no longer orphaned is kept. A removal is not lost work: recent Home Assistant versions keep the removed entity's settings (entity ID, name, icon, area, labels), and gives them back if its integration ever provides it again
  • Used by: each orphan shows what still uses it (automations, scripts, scenes, groups, dashboards), with links to their editors, and the confirmation warns before removing entities still in use
  • Orphan devices: devices whose integration entries were all removed, listed under the entities; select some to remove (with their entities) or ignore, or remove them all
  • Ignored integrations, entities and devices, in the options or with the card's Ignore button
  • Orphaned entities sensor with the list, Last scan sensor, Scan now button
  • orphan_entities.scan, orphan_entities.remove, orphan_entities.remove_devices and orphan_entities.ignore actions for administrators, orphan_entities_removed and orphan_entities_devices_removed events
  • Lovelace card bundled with the integration: search, integration and reason filters, selection one by one or of every match, Remove and Ignore in bulk
  • Mini card: the orphans by reason on two lines, with a detail button showing the full card
  • English, French, German, Spanish, Italian, Dutch, European Portuguese, Polish, Serbian (Cyrillic and Latin), Romanian, Danish, Swedish, Bulgarian, Russian, Ukrainian, Hungarian, Slovak, Czech, Slovenian, Latvian and Greek; pt-BR uses the European Portuguese texts

Prerequisites

Prerequisites

  • Home Assistant 2024.12 or newer
  • Nothing else: the integration only reads Home Assistant's own registries, and its card is installed with it

Configuration

Configuration

Add integration

Settings → Devices & services → Add integration → Orphan Entities. Change the options later with the Configure button.

Option Default Description
Scan interval 15 min Minutes between two scans, from 1 to 1440. The registry is also scanned 10 seconds after it changes
Grace period after startup 10 min Minutes after Home Assistant has started before the first automatic scan, from 0 to 1440. A scan asked for (button, action) runs at once
Stale after 24 h Hours an entity still provided by its integration must have been unavailable (or unknown) to be listed, up to 8760. 0 lists only the entities no longer provided
Include unknown entities on Also list the entities unknown for that long. Buttons, scenes, events and other entities unknown by design are never listed
Ignored integrations none Integrations whose entities are never listed. The list offers the integrations that own entities; type a domain to add another one
Ignored entities none Entity IDs, and device IDs of orphan devices, never listed (devices shown with their name). The card's Ignore button adds them here

What counts as orphaned#

Reason When
Integration removed The entity belongs to a config entry that no longer exists. Listed even when the entity is disabled
Integration not loaded The entity has no config entry (YAML platform), Home Assistant only restored it, and its integration is not loaded
Not provided Its integration is loaded but no longer creates it: Home Assistant only restored it ("not provided" in Home Assistant)
Unavailable Still provided, unavailable for longer than Stale after
Unknown Still provided, unknown for longer than Stale after (with Include unknown entities)

Left out: disabled entities (but those of a removed integration), entities of a disabled integration or of one that failed to set up (they come back with it: that's the job of Integration Watchdog), the ignored integrations and entities.

Orphan devices are the devices of the device registry whose config entries no longer exist, all of them (a device shared with a live entry is still provided). Removing one deletes it from the device registry with its entities, as Home Assistant does when an integration is removed cleanly; those entities count in removed and are in an orphan_entities_removed event.

Used by#

Before you remove an orphan, the integration tells you what still uses it, so that you don't break an automation. At each scan it looks for each listed entity in:

Where How Link in the card
Automations Home Assistant's own references of each automation (triggers, conditions, actions) Automation editor, for automations with an id (those made in the UI)
Scripts Same, for each script Script editor
Scenes The entities each scene sets Scene editor, for scenes with an id
Groups Old-style groups (group.*) and group helpers (light, switch, sensor… groups) —
Dashboards The configuration of each dashboard in storage mode (edited in the UI), searched for the entity ID The dashboard

Only the loaded integrations are asked: without automations, for instance, none is listed. Each entity gets a used_by list in the entities attribute (type: automation, script, scene, group or dashboard, id, name, path: the editor page or dashboard, or null).

Orphan devices get one too, in the devices attribute: the automations and scripts that use the device itself (device triggers, conditions and actions, or a device_id target). The card shows the same Used by n badge on their rows, and the confirmation asks to Remove anyway when devices still in use would be removed.

Limits:

  • YAML dashboards (and the dashboards of a YAML-mode Lovelace) are not scanned, nor are the YAML files themselves: a card defined there is not found
  • Templates are not resolved: an entity named only inside a template ({{ states('sensor.x') }}), built from a variable, or targeted through an area, device or label is not found
  • References are refreshed at each scan (every Scan interval, after registry changes, or with Scan now): an automation edited since then shows up at the next scan. Dashboards are read at the first scan, then again only when one is saved

Removing an entity deletes its entry from the entity registry, as its Delete button does in Home Assistant. Its history stays in the database. An Unavailable or Unknown entity is still provided by its integration: it comes back if the integration creates it again (after a reload or a restart).

Entities#

Entity Description
button.orphan_entities_scan_now Scans now, even within the grace period (nothing while Home Assistant is starting)
sensor.orphan_entities_orphaned_entities Number of orphaned entities (unknown until the first scan). Attributes: entities (list of entity_id, name, platform, reason, since, entry_id, entry_title, device, disabled, used_by: what still uses it, see Used by), next_scan (end of the grace period after a start, until then), counts (per reason), removed (since Home Assistant started), stale_hours, include_unknown, ignored_integrations, ignored_entities, devices (orphan devices: device_id, name, manufacturer, model, entities, since, used_by), truncated (orphans left out of entities), devices_truncated (orphan devices left out of devices). entities and devices hold at most 250 items each, the most certain orphans first; the state keeps the full count. The lists are not recorded in the database
sensor.orphan_entities_last_scan End of the last scan

Action orphan_entities.scan#

Scans the entity registry now, even within the grace period. For administrators. Refused while Home Assistant is starting.

action: orphan_entities.scan

Action orphan_entities.remove#

Removes entities from the entity registry. For administrators. Each one must be in the list of the last scan: otherwise nothing is removed. Each one is also classified again just before: an entity no longer orphaned since the scan (its integration is back, it is available again) is kept and returned in skipped. At most 1000 at a time. Returns the entities removed and skipped (Home Assistant 2025.1 or newer).

action: orphan_entities.remove
data:
  entities:
    - sensor.old_temperature
    - light.old_lamp
response_variable: result  # {"removed": ["sensor.old_temperature"], "skipped": ["light.old_lamp"]}

Action orphan_entities.remove_devices#

Removes orphan devices, with their entities. Only the devices of the last scan's list: any other refuses the request. Without devices, every orphan device of the last scan is removed (also those the devices attribute leaves out, at most 1000). Each device is checked again just before: one whose integration is back is kept and returned in skipped. At most 1000 at a time. For administrators. Fires orphan_entities_devices_removed, and orphan_entities_removed with the entities removed with the devices.

action: orphan_entities.remove_devices
data:
  devices: 3b1f0c2e9d8a4f6b
response_variable: result  # {"removed": ["3b1f0c2e9d8a4f6b"], "skipped": [], "entities": ["sensor.old_hub_temperature"]}

Action orphan_entities.ignore#

Adds entities, or orphan devices (devices, device IDs), to the Ignored entities option: they are no longer listed. For administrators. Give entities, devices or both.

action: orphan_entities.ignore
data:
  entities: sensor.kept_on_purpose
  devices: 3b1f0c2e9d8a4f6b

Event orphan_entities_removed#

Fired after each removal, with entities, the entity IDs removed (also those removed with orphan devices).

Notify when new orphans appear:

triggers:
  - trigger: state
    entity_id: sensor.orphan_entities_orphaned_entities
conditions:
  - condition: template
    value_template: >
      {{ trigger.from_state.state | int(0) < trigger.to_state.state | int(0) }}
actions:
  - action: persistent_notification.create
    data:
      title: Orphan Entities
      message: "{{ trigger.to_state.state }} orphaned entities"

Card

Card

The integration serves the Orphan Entities Card and adds it to the dashboard resources (or loads it on every page when the resources are managed in YAML): no separate install. Add it from the card picker, or:

type: custom:orphan-entities-card
  • Header: status (n orphans, no orphan, waiting for the first scan), time of the last scan and the Scan now button. On a narrow card the status takes a second line, shortens, then keeps only its coloured dot
  • Summary: orphans, removed since Home Assistant started, ignored (listed on hover)
  • Filters: search on the name, entity ID, integration, device and config entry; integration list; a chip per reason with its count
  • List: for each entity, its integration's logo, name, entity ID, device, reason and for how long. No longer provided in red, stale in orange. A long list stops at Rows shown, then Show all. Past 250 orphans, a note says how many more there are: remove or ignore the first ones to see them
  • Used by: an entity that an automation, a script, a scene, a group or a dashboard still uses gets an orange Used by n badge; its tooltip lists them, a click opens the list under the row, with links to their editors. When some selected entities are still in use, the removal confirmation says how many and asks to Remove anyway
  • Selection (administrators only): click a row to select it; Select the n shown selects every entity matching the filters, including those past Rows shown. Ignore and Remove then act on the selection, after a confirmation at the top of the card (Escape cancels). Other users see the list without checkboxes
  • Orphan devices: Remove devices removes them all (also those the list leaves out, which a note under the list counts); administrators can also select some (click a row), then Ignore or Remove devices act on the selection only

Every option is in the visual editor:

Option Default Description
entity found automatically The Orphaned entities sensor
title Orphan Entities Card title
show_stats true Summary tiles
show_filters true Search, integration and reason filters
max_rows 25 Rows shown before Show all, from 1 to 500
scan_button true Scan now button in the header. It presses the button entity, so any user who sees the card can scan
hide_when_empty false Hide the card while there is no orphan (always shown while editing the dashboard)
language Home Assistant's en, fr, de, es, it, nl, pt, pl, sr, sr-Latn, ro, da, sv, bg, ru, uk, hu, sk, cs, sl, lv or el

Mini card#

custom:orphan-entities-mini-card shows the essentials on two lines: the icon, title, Scan now button and status, then a chip per reason with its count (Not provided · 2) and the time of the last scan. Search for Orphan Entities Mini Card when adding a card, or in YAML:

type: custom:orphan-entities-mini-card
  • The detail button (top right) switches the card to the full card, with the same options, and back, as does a click anywhere else on the page
  • A reason's chip opens the full card filtered on that reason
  • In a Sections view the card takes 6 columns by default, its minimum

It takes every option of the full card (they set its detail view), plus:

Option Default Description
zoom true Detail button showing the full card. false removes it

How it works

How it works

At each interval, and 10 seconds after the last change of the entity registry or of a config entry, the integration goes through the entity registry, reads each entity's config entry and state, and classifies it. It then asks the automations, scripts, scenes and groups which listed entities they use, and searches the dashboards in storage mode for them (read at the first scan, then again only when a dashboard is saved). Entities only restored by Home Assistant carry restored: true in their state: their integration didn't create them. No automatic scan runs before Home Assistant has fully started and the grace period has passed; a scan asked for with the button or the action only waits for the start.

To report a problem, attach the diagnostics (Settings → Devices & services → Orphan Entities → ⋮ → Download diagnostics): the options and the last scan (listed entities and devices, counts, what uses them), with config entry titles (often an account or a host) and any password, token, key, username, email, host, URL, address, GPS position, VIN, plate or tracking number redacted.

To debug:

logger:
  logs:
    custom_components.orphan_entities: debug

Support

Support

If you find this project useful, you can support its development:

Buy Me a Coffee

1.7.0Nov 11, 2026Latest

Deprecated

  • Orphan Entities is now a module of System Hub, and this repository is archived: no more updates here. Turned on in System Hub, the module takes over the settings of Orphan Entities. While both are set up, Orphan Entities raises a repair in Settings → Repairs, as it would otherwise run twice and register its cards twice: remove Orphan Entities and its card resource once the module is on. See Migrating (juju35/ha-system-hub#49, thanks @FredM67).

1.6.2Nov 11, 2026

Fixes

  • No more deprecation warning accesses ChildDeviceEntry.model / .manufacturer in the log (it would fail from Home Assistant 2027.9) for an orphaned sub-device: its model and manufacturer are read from its parent device (reported on juju35/ha-smart-comfort#58 by @FredM67).

1.6.1Nov 9, 2026

Maintenance

  • No code change: released again to check the installation from the Marketplace.

1.6.0Nov 9, 2026

Performance

  • Translations load on demand: in the release zip, the frontend files keep English only (orphan-entities-card.js 167 KB → 78 KB) and each other language is its own <file>.i18n.<lang>.js file next to them, fetched the first time a card or the panel needs it. Home Assistant loads the card on every dashboard, so each page used to download and parse all 22 languages to use one. The cards and panel are defined once the page's language has arrived (a few milliseconds), so they render translated from the start.

Maintenance

  • The repository keeps every language in the sources: the release runs scripts/split-frontend.mjs before building the zip, and the Validate workflow checks the split on a copy (every table is rebuilt from the split files and compared).

1.5.0Nov 8, 2026

What's new

  • Used by, for devices too: each orphan device lists the automations and scripts that still use it (used_by in the devices attribute), shown with a Used by n badge in the card, and the removal confirmation asks to Remove anyway when some are in use. Translated in every language.
  • Remove every orphan device: orphan_entities.remove_devices without devices removes every orphan device of the last scan, and the card's Remove devices without a selection now does so, including the devices the sensor leaves out; the new devices_truncated attribute and a note in the card say how many are left out of the list.

Fixes

  • After a removal, the card's message counts the entities or devices actually removed and those kept because they are no longer orphaned, instead of the number selected.

1.4.0Nov 7, 2026

What's new

  • Orphan devices, one by one: administrators select devices in the card, then Ignore or Remove devices act on the selection only (Remove devices without a selection still removes them all). The orphan_entities.ignore action takes device IDs (devices), shown by name in the Ignored entities option.
  • Checked again before removal: remove and remove_devices classify each entity or device again first, keep the ones no longer orphaned since the scan and return them in skipped.
  • Device removal counts its entities: the entities removed with orphan devices count in removed and are in an orphan_entities_removed event, and remove_devices takes at most 1000 devices at a time.
  • Lighter sensor: the entities and devices attributes hold at most 250 items each (the new truncated attribute and the card say how many orphans are left out), and the dashboards are read again only when one is saved, not at every scan.