Cannot delete unavailable entities

Seems to be quite a frequent question, but still no working answer for me.
I’ve downloaded and enabled an integration, created a custom file for configure the device for the integration, and after some modification I’ve finally managed to have a valid version of this file but this process lead to to create some (wrong) entities that now appears as unavailable.
When I go to "Settings → Devices & Services → Entites " I can filter for them but there is not the checkbox that allows me to delete them

I am logged in as admin so I don’t think it’s a permission problem.
Being on a docker I cannot use the script that is on antoher thread here on the forum.
Can you explain me why there is not the checkbox ?
How can I delete them ?

Thanks in advance.

Pierluigi

1 Like

You can delete them from the Integration it is using. In your example, for example, MQTT.
afbeelding

I answered a similar question a few days ago, maybe you can check this topic/post.

For the MQTT devices, how did you add them? If the device is added by MQTT autodiscovery you can remove it by removing it from it’s MQTT topic. I use MQTT Explorer which is very helpfull.

EDIT: BTW, make a backup before experimenting. :wink:
EDT2: Deletion may differ by which integration the device is using.

I hope this helps.

1 Like

My problem are not the MQTT, that I add them by mqtt.yaml, so I can manage to remove quite easly. My real problem is the solarman integration.
I’ll give a look at your thread, thanks

Click to enlarge

2 Likes

If the solution is there it looks so obvious and easy! Thank you @tom_l.
I Learned something today :+1:

1 Like

Thanks for your reply, and yes, in this way the checkbox appears ( which is fine ) but still I cannot click on it ( it does not change color or appears the tick ) on the solarman unavailable entities:

There should be some other way…
I’ve also tried to remove them from the core.registry ( only place where they appears ) but still they come back.
I’d rather not remove the integration as I would not loose the historical values, Probably I’ll leave there until they ( probably ) disappears by the purge process ( could it happens ? ).

It seems that the problem is that those entities have not an unique id:
Screenshot_20240914_192049

They are, by the way, present in states table in the sqllite db so, whenever I remove them from the ./.storage/core.entity_registry
they probably get recreated when the HA restarts.

Any idea ?

I had these kind of problems in the past when using the Fibaro Hub integration. The problem was the integration generated the entities.

So I had to delete (or HA access) to the entities at the Fibaro Hub, restart HA and then I could delete them. I think nowadays you can reload the integration if it is not configured in HA config YAML files.

What is solarman? How was the integration added to your HA?

Make a backup before fiddling around, just to be sure.

Try this:
Go to:
your-server:8123/developer-tools/action

and then use this action to delete a device:

Solarman is the integration for some photovoltaic inverters
I’ve already removed the integration, restarted HA and reloaded the integration ( without those entity ) but they are still there.

you can remove those entities by purging them the way i show in my previous reaction.

At the end I had to delete from sql all the occurence from states, states_meta , event_data
First I’ve fount the metadata_id from states_meta:

select metadata_id from states_meta where entity_id like '%ENTITY_TO_REMOVE%'

( example if you have to remove, say, current_output_s you should do

select metadata_id from states_meta where entity_id like '%current_output_s%'

)

then with those values I issued:

delete from state where metadata_id in ( __list_of_values_from_previous_query__ )

then the same but from states_meta:

delete from state_meta where metadata_id in ( __list_of_values_from_previous_query__ )

and finally from the event_data table:

delete from event_data where shared_data like '%ENTITY_TO_REMOVE%'

( as before if you have to remove, say, current_output_s you should do

delete from event_data where shared_data like '%current_output_s%'

)
If you haven’t already done, remove any occurence also in
.storage/core.entity_registry or wherever you find them.

Please, remeber to backup everything before any of these commands.
Thanks everyone for hints

Sorry, also this didn’t worked.
The solution has been posted, by me, just before this answer.
Thanks anyway

1 Like