Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can’t delete 5000 entities created by Remote HAS Loop #320

Open
Brockmsi opened this issue Oct 23, 2024 · 6 comments
Open

Can’t delete 5000 entities created by Remote HAS Loop #320

Brockmsi opened this issue Oct 23, 2024 · 6 comments

Comments

@Brockmsi
Copy link

Hi
through a misconfiguration of Remote Home Assistant a loop between 2 systems occurred an created on both ends 50k entities.
I’re able to delete most of them but 5k still remaining and aren’t deletable.
“You can only delete 0 of the 1 entities. The others require the integration to stop providing them, and sometimes a Home Assistant restart is needed. Are you sure you want to delete the deletable entities? Remove them from your dashboard and automations if they include these entities.”

The integration doesn’t exist anymore and HAS was restarted countless times, also there are no dashboards nor automations with them.

Any ideas on how to brut force the delete of these entities?

In the first place I thought it was because I included all domains on both sides, now I realised that all entities&co getting added to the other side no matter the fact that I only included a few entities and excluded the rest of it including the domains.

Many thanks in advance!

@captaincanada
Copy link

captaincanada commented Nov 11, 2024

Same here
Screenshot_20241111_123018_Home Assistant
how to delete thousands of entities 🙈

@captaincanada
Copy link

@Brockmsi
did you find a solution to delete all of this foolish entities?
will they disappear when I delete the remote HA Device?
thx to everyone who helps

@Brockmsi
Copy link
Author

@captaincanada
Unfortunately no.
In the use case I have I now will add a SLZB 06 Stick and I'll extend the Zigbee network with it instead of Remote Homeassistant.

But that's just a work around.
With the issue Remote Home Assistant isn't usable for a 2 way setup between 2 HA instances.

@rafal98
Copy link

rafal98 commented Dec 1, 2024

Same here too (72K entities) !

I found the various entry in 3 SQL tables and be able to remove them, but at next restart, all removed data are restored. It's probably a docker effect. I found that a big json file also contains all entities. Editing it, same issue, it go back.

Stopping docker, also stop the ssh server, and supervisor restart the HA container so I can't fix it. I'm a noob on docker, if someone known how to stop container and let me works on DB and json, then restart container, it help me a lot !

@gitenco
Copy link

gitenco commented Dec 29, 2024

I seem to run into this problem too. Just out of curiosity: did you add entities from the remote HA with the help of the user interface or with a YAML config?

@rafal98
Copy link

rafal98 commented Jan 1, 2025

Hi, just to notify that I have fixed my HA instance. About docker, I was just doing "docker stop ", but "systemctl stop docker is the right thing to do.

Then after I edit the core.entity_registry file to remove ALL entities linked to remote_homeassistant

cd /mnt/data/supervisor/homeassistant/.storage
cp core.entity_registry core.entity_registry.orig
grep -v remote_homeassistant core.entity_registry.orig > core.entity_registry

About the sqlite DB:

cd /mnt/data/supervisor/homeassistant/
sqlite3 home-assistant_v2.db
delete FROM "state_attributes" where attributes_id in (SELECT attributes_id FROM "states" where metadata_id in (select metadata_id from states_meta where entity_id like '%_2_2' ESCAPE ''))

was just removing *_2_2 and not *_2 because I have some entities finishing by _2 not related to remote_ha

Then restart docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants