remote_homeassistant icon indicating copy to clipboard operation
remote_homeassistant copied to clipboard

Can’t delete 5000 entities created by Remote HAS Loop

Open Brockmsi opened this issue 1 year ago • 8 comments

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!

Brockmsi avatar Oct 23 '24 17:10 Brockmsi

Same here Screenshot_20241111_123018_Home Assistant how to delete thousands of entities 🙈

captaincanada avatar Nov 11 '24 11:11 captaincanada

@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

captaincanada avatar Nov 17 '24 07:11 captaincanada

@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.

Brockmsi avatar Nov 21 '24 16:11 Brockmsi

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 !

rafal98 avatar Dec 01 '24 13:12 rafal98

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?

gitenco avatar Dec 29 '24 09:12 gitenco

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

rafal98 avatar Jan 01 '25 17:01 rafal98

This is a big pain in the rear. Why don't the instructions for setting this HACS integration clearly say that you should NOT try to setup two instances to "remote" back to each other as it will create this nasty loop.

cliffkujala avatar Aug 26 '25 16:08 cliffkujala

This problem has existed for a long time, I'm surprised that it hasn't been patched or addressed as it is a huge pain to clean up.

ctops1 avatar Oct 28 '25 02:10 ctops1