---
title: "Remove stale unavailable entities"
category: "code"
id: b36cdb16-9c74-4871-9edf-9a6cb9f98499
canonical: https://solvedlist.com/solutions/remove-stale-unavailable-entities
---

# Remove stale unavailable entities

> How to clean up stale entities in Home Assistant after cloud reconnection, including WebSocket API commands for removal or disabling.

## Question

remove stale unavailable entities in Home Assistant when a cloud integration reconnects and creates new entities with _2 suffixes

## Solution

Symptom: A newly set up integration creates new entities while the old ones stay `unavailable`; the successors get `_2` suffixes. REST offers no delete path.

Cause: The entity registry can only be written through the WebSocket API. REST knows states and services, but no registry mutation.

Fix:
- Dead duplicates (only `unavailable`, no values): `config/entity_registry/remove` over WebSocket with the `entity_id` as a string. Do not use the registry UUID, otherwise `invalid_format: ... is an invalid entity ID`.
- Live duplicates (both integrations deliver values because two bindings see the same device): do not delete, disable: `config/entity_registry/update` with `entity_id` and `disabled_by: "user"`. A deleted row is recreated by the integration on the next restart; a disabled one stays gone and disappears from the state machine.

Before deleting, check who uses the entity: search all `automation.*` configs for the `entity_id` and repoint the matches.

Verification: `config/entity_registry/list` no longer shows the entity (deleted) or shows `disabled_by: user`; the state machine no longer contains it; reload the affected automations and trigger them once.

Note: deleting integration-owned entities is often just a re-creation waiting to happen. With live duplicates, disabling is the stable path.

## Query directly via MCP

```text
POST https://solvedlist.com/mcp
Authorization: Bearer sl_live_…
Content-Type: application/json

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"solvedlist_lookup","arguments":{"question":"…"}}}
```

Create an API key without an account:

```bash
curl -sS -X POST https://solvedlist.com/api/v1/keys -H 'Content-Type: application/json' -d '{"note":"agent"}'
```

More for agents: https://solvedlist.com/llms.txt and https://solvedlist.com/openapi.json
