Vera Error - Entity ids already exist, unable to toggle devices on and off

Tags: #<Tag:0x00007f77fa979388>

I have been using HASS with VERA for a few years with no problems but recently I’m not able to toggle some of my switches on within HASS. If I toggle the switch on from the frontend, the switch is toggled right back off and the light never turns on. In the logs, I am seeing errors when HASS loads that look like this:

2020-02-12 22:38:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 415, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: switch.water_valve_112. Platform vera does not generate unique IDs

I am using HASS 0.105.3 right now.

1 Like

I’m seeing the same behaviour, only very recently does this seem to happen for some components on boot with the same exceptions about entity id already exists. I don’t have any duplicate IDs as far as I’m aware, nothing has changed on the Vera side.

Also HASS 0.105.3

Same here. Already tried to reset HA db. Have you resolved?

This seems to have occurred in my case because my Vera started passing through a whole lot of devices with a _2 suffix with the same ID as the old devices without that suffix.

I have resolved this in HA as follows:

  1. (BACK UP THIS FILE FIRST!) Removing all Vera entities from the (hidden) .storage/core.entity_registry file. Search through it for the string ‘vera’ and remove each json entry. I used the VS Code add-on to do this but I imagine you could SSH in or possibly use Configurator

  2. Restart home assistant

  3. Search the Entities config screen for ‘vera’ and you’ll see all your entities newly-imported (without any errors about dupicate IDs)

  4. Because a lot of mine now had the _2 suffix, I selected each one and renamed it back to the entity name I used previously

After doing that, the devices all worked for me again. I also took the opportunity to make good use of the exclude: option of the vera integration to stop importing so many things I simply wasn’t using.

Hope that helps you!

Unfortunately it doesn’t resolve the issue. I still receive “Entity id already exists”. Already tried to reset all database and clean .storage folder :cry:

Same with me. I have deleted the entities file and restore state file.

I also have a lot of log entries that look like this:

Unhandled exception in callback for device #75 (Living Room Lights)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyvera/subscribe.py", line 155, in _event_device
    callback(device)
  File "/usr/src/homeassistant/homeassistant/components/vera/__init__.py", line 162, in _update_callback
    self.schedule_update_ha_state(True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 418, in schedule_update_ha_state
    self.hass.add_job(self.async_update_ha_state(force_refresh))
AttributeError: 'NoneType' object has no attribute 'add_job'
Connection lost. Reconnecting…

I have the same problem. It started with 104, I think it is because of the changed entity handling at startup. Even if I delete all of my entities and disable the integration and do a restart to be sure that there are no vera entities left and restart again with everything enabled I get the error messages. Therefore still stuck at version 103.6.

I’m now running the latest 105.5 and not seeing any of the above errors any more after following the steps with removing the entities from HA and allowing vera to add them all again afresh. Prior to that I had both the add_job and duplicate entity_id issues which seem closely related.

It’s very odd.

Thanks so much everyone for your help. i’m running the latest 105.5 and all vera stuffs are working again.

@ricochet @phi426en What happens when you restart again? The first time it works for me, but when I restart, I get the errors again.

I also reverted to 0.103.6 per @BvL87 and will stay here for awhile. I am now taking full snapshots much more seriously.

Experiencing same issues on 0.105.5. I also tried following ricochet’s steps, but it didn’t help (also, I couldn’t rename the entities to remove the _2, as it said the entity was already registered, even though I had removed them). Going to roll back to 0.103.6

I have 23 of these errors in my logs:

homeassistant.exceptions.HomeAssistantError: Entity id already exists: switch.back_spotlight_118. Platform vera does not generate unique IDs
2020-02-19 10:42:18 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 415, in _async_add_entity
    raise HomeAssistantError(msg)

I had that too (not being able to rename the entities with the _2 suffix). I ended up renaming them in the .storage/core.entity_registry file. Then do a reboot. It works until the next reboot. Then the errors appear again.

I can definitely confirm that it remains working fine for me after restarts.

The fact that some are unable to rename the _2 entities back to their original names via the Entities screen after import seems very odd, as though those original entities and their conflicting IDs are still being referenced somewhere else by HA?!

But the question is where. And it is also completely random which entities conflict. Sometimes there are only 5, than more than 30. I can’t get my head around it. But it is really frustrating because I want to upgrade. I use my vera for almost 7 years (have the vera lite) and have almost 50 devices paired to it.

I had a clean install on .105.4 with a Vera device. I saw the apparently random duplication of some vera devices (_2). I initially removed the vera settings from configuration.yaml, rebooted, added the settings back, after this there was still entities with _2 in the entity name. I edited the core.entity_registry file and removed the “_2” from the field “entity_id”. To note, at this stage I only had one entry for each device in the core.entity_registry, i.e. for the devices with _2, there was not another entry for the device without the _2. I am not sure if this was the case before I re-setup vera. After several reboots, I have not seen the _2 come back.

I’ve been following this thread from the start. I’m currently on 103.4 and would like to update to 106 but have been waiting for the Vera issues to get resolved. Has anyone here been able to go to 106 without a recurrence of the noted issues?
Thanks,
kartcon.
aka Art

im having this problem to since 106, i can control some devices but not others,
very annoying.

this works for me, go to settings, configuration,entities, type vera in search, delete entities, (working entities will remain) restart ha, now all my entities work again (2 of 100 entities i had to ad _2 on the name, but i did this before trying the other way so may not be necessary) doing it this way i didn’t lose any of my configurations and it only took a minute to do.