QUESTION: How to delete an invalid entity with no unique ID (UNSOLVED)

I’ve changed the name of my light entities. Now config/entities lists the new entities and the old entities, the latter doing nothing other than confusing me when I’m trying to find the name of my entities. They had no unique ID and cannot be deleted through the interface. A global search for the entity name in .storage files produces nothing.

The system is now essentially unusable as there is no way to determine by inspection through the config/entities panel which are valid and which are invalid entities other than opening them up and trying to switch them on, which is too time consuming.

Before I abandon Home Assistant, may I ask if anyone knows what to do in this situation?- searching produces evidence over the last year or two of lots of chatter on this issue, but I can’t find a solution. I can’t believe there isn’t one - renaming entities is such a basic requirement.

Assuming there is a fix - how do you rename entities in a way that avoids this?

Thank you ( Home Assistant 2022.4.1)

1 Like

Restart home assistant. You should then be able to delete the old ‘restored’ entities from the Configuration / Devices & Services / Entities page.

Which integration are you using that is doing this?

How did you “rename” them, in the UI or using YAML?

Are you actually talking about changing the name or entity_id?

Thanks, Tom. I’ve restarted home assistant several times.

One of many sources of confusion in the interface is that there seem to be at least two ways to enter config/entities. Arriving by clicking entities from integrations produces a view that shows entities are being disabled, a checkbox allowing them to be selected, and a remove selected link. This produces an error that refuses to allow the entity to be removed, claiming that it is being provided by, and simultaneously disabled by, the integration. Quite what that means I don’t know.

The lights are being supplied by Hue, and by Tasmota power switches classified as “light”. A number of light groups were defined in a config file which has been deleted.

Entities were renamed in config/entities, and are referred to in a package file light.yaml in which several light groups were created with the new names.

I’m talking about deleting the invalid items that are listed in config/entities that have both Name and Entity ID.

Update:

  1. removed Hue integration
  2. configuration.yaml (only):
    default_config:
  3. rebooted twice
  4. the result of searching for entities with light.:

I can’t remove these, or find any references to those Entity IDs in any file in .storage. Absolutely baffled.

Update 2 (I’m talking to myself, but in case anyone else finds this detective process useful). I did discover references to the invalid entities in a file called .core.restore_state, which led to a posting by @tom_l here: Core_restore_state Filling up with renamed entitys - Configuration - Home Assistant Community (home-assistant.io), which references something called Configurator. But doesn’t explain what this is, or whether it accounts for zombie entities that refuse to die.

More weirdness. The checkboxes in this dialogue box in the config/entities screen always show “show unavailable entries” and “Show read-only entries” as ticked regardless of what you select.

Screenshot 2022-04-10 at 13.52.17

The dozen or so articles I’ve found online all refer to resolving this fault by editing.storage.core.entity_registry, but there are no references to these entities in it or in any other file in .storage or config.

More weirdness:

this config:

  - platform: group
    name: Masterbedroom Group
    entities:
      - light.masterbedroom_bed
      - light.masterbedroom_floor

produces this entry in the default dashboard:
Screenshot 2022-04-10 at 15.13.06
But selecting Masterbedroom Group only activates Masterbedroom Floor.
Screenshot 2022-04-10 at 15.13.28

I’m guessing because Masterbedroom Bed is conflicting with some zombie version of itself.

So the only place that you have any lights configured are in your lights.yaml file? And those are only light groups?

no other light.x entities anywhere else (as indicated by your screenshot above)?

where do those two light entities exist in your group example?

I’m trying to follow here but it’s kind of confusing.

Yes - I’ve cleared everything out except for a single ‘packages’ file defining some light groups. But the front end is reporting a dozen light entities that don’t exist and I can’t get rid of, some of which corresponded with the names of lights that were (re)created when I re-added the Hue integration.

To be honest, I’m inclined to hose the installation i.e. reset the database and start again, but I can’t even find simple instructions for doing that.

UPDATE: The same problem - a group button not activating all of the lights in the group - occurred with the living room group. I discovered that (re)adding the Hue integration created light.livingroom_group, added the hues to it, and added a group button to the dashboard wired to light.livingroom_group.

It silently created entity light.livingroom_group_2 from light.livingroom_group defined in the config file. So the button on the dashboard only activates the hues, not the hues and the other (non-hue) light defined in the config file.

Screenshot 2022-04-10 at 17.36.37

Screenshot 2022-04-10 at 17.33.41

…and the outcome of renaming the Hue generated group to light.livingroom_group_hue: an entity called light.livingroom_group has now been created, presumably from the package config file. light.livingroom_group_2 is now a zombie entity that does nothing, and I cannot discover a way of deleting.

From now on, the active one can only be determined by opening both up, pressing the switch, and seeing if any lights come on or not.

What an absolute fiasco.

I recommend removing the group lights until you get the initial light issues resolved. it seems to just be confusing things.

you can just rename the lights.yaml package file to lights.yaml.old and reload groups. then all of the groups should be gone and all you should have are the real lights.

do that and let’s see where you stand after that.

Thanks finiti. As part of trouble shooting, I removed every configuration file, reverted configuration.yaml back to the single entry default_config:, and rebooted sever times. That’s what produced the list of zombie entities in QUESTION: How to delete an invalid entity with no unique ID (UNSOLVED) - #4 by richlyon

Ok, so now you still have light groups as per your screenshot above?

if you click on those group light entities to open the entity config window in the bottom left hand corner of the pop-up is there no option to remove the entity?

There’s no option to remove them. But several appear to have disappeared overnight! I must have reset HA a dozen times and they wouldn’t flush, but when I got up this morning and had a look, many had gone. I can’t imagine what’s going on in the back end to produce this. Now I have half a dozen zombie scenes with the old names after I renamed a few. Perhaps they will disappear overnight too.

Sorry I can’t help anymore. I’ve never experienced the issues you are having.

Especially with a fairly new install.

I’m also stuck with this at the moment, created some rest sensors with spelling mistakes, and now I cant get rid of them. Tried clicking reload rest sensors in settings, and it created another one named ‘…_2’

They don’t appear anywhere in the .storage folder, so I can’t get rid of them that way.

In the Config → Entities, they are ‘read only’ and the box next to them is greyed out so I can’t tick and delete them.

I’m not sure this was a good idea, but I was able to solve this by creating a new group (available in the gui through helpers in 2022.4) with the same domain type (i.e., light in my case) and entity name, then deleting it. It removed it from entities altogether and it is no longer visible in the GUI. Curiously when I grep my /config directory for that entity name I still see references to it in the db, but it no longer shows up in the GUI. Use that FWIW.

4 Likes

Interestingly I fixed mine by clicking Reload ‘Template Entities’. Even though I had restart HA many times and it did not fix it, clicking that instantly got rid of all the rest sensors that didnt exist.

6 Likes