zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

zigbee2mqtt UI in home assistant displays group that is out of sync with its underlying database

Open adamawolf opened this issue 2 years ago • 18 comments

What happened?

I was working on renaming some of my zigbee devices and groups to have a more consistent naming scheme.

I renamed a group but found that after renaming that group it wasn't getting picked up by the HomeKit Bridge integration (not getting sent to Home.app). So I created another group that included the same zigbee devices, and this group was successful in sending to Home.app via the HomeKit integration.

So far, mostly ok. The real problem started when I went to rename the next set of devices/groups. I renamed the devices, then this time decided I would delete the existing group and create a fresh one (to avoid the possible failure to sync to HomeKit bug I experienced the first time). I created the new group, but then when I attempted to add a device to that group I got the error message: z2m: Failed to add from group (DatabaseEntry with ID '31' does not exist)

I tried to delete that group, thinking that something might be wrong with that particular group. I got a similar error (Failed to remove group 'stairway_chandelier' (force: false) (Error: DatabaseEntry with ID '31' does not exist)

Ditto if a create a new group.

What did you expect to happen?

Adding devices, or removing the broken group would be successful.

How to reproduce it (minimal and precise)

Please see my What Happened? answer for the closest I have to repro steps.

Zigbee2MQTT version

1.40.1

Adapter firmware version

20240710

Adapter

SLZB-06

Setup

Add-on on HAAS, running on a minix 0db

Debug log

z2m_err.log

adamawolf avatar Sep 10 '24 06:09 adamawolf

Could someone point me towards where I can poke around the internal database z2m add-on uses to track the state shown in the Frontend? It seems like for whatever reason z2m has an ID cursor that's out of sync with reality (where "reality" is defined by the actual zigbee protocol groups).

This is a new Home Assistant install I'm setting up in a new home (just moved). Unfortunately I didn't have my NAS set up yet so don't have any backups to rollback too. Hoping I can fix forward 😬

adamawolf avatar Sep 10 '24 23:09 adamawolf

Did you ever get this resolved.? This exact issue just happened to me.

ruderthanyou avatar Oct 25 '24 23:10 ruderthanyou

I'm running into this as well. I have a fresh install and made 3 groups without issue, then I made a 4th (and renamed it immediately if that's relevant).

Now when I create a new group I cannot add new devices (Error: DatabaseEntry with ID '31' does not exist)). The weird thing is that if I then refresh the page z2m does show devices in the group, however the group is not present in Home Assistant.

When I try to remove the group I get the same error, but removing it a second time immediately after does get rid of the group (since it probably never existed). It doesn't matter how many new groups are made, any new group made through the frontend does not function at all.

Edit: creating a group with a group id different from the default does fix this. In my example I made a group with id 10, and that group behaves as normal

emaasland avatar Nov 06 '24 20:11 emaasland

I confirm the problem. 1.41.0 "Failed to add from group" (DatabaseEntry with ID '7' does not exist)

vukitoso avatar Nov 21 '24 08:11 vukitoso

I have the same issue. Few weeks ago I found that one device is missing. I tried to re-pair without sucess. Zigbee2MQTT version: 1.42.0-1 image

TokoTSP avatar Dec 02 '24 15:12 TokoTSP

In general, the "Failed to add from group" error means that the device does not support the Groups cluster. I was trying to add a button to a group.

To check the presence of a Groups cluster, you need to go to the device, to the Clusters tab. And there should be genGroups in "Output Clusters". If there are no genGroups, then the button does not support group addressing. For light bulbs and led controllers, genGroups should be like "Input Clusters"


В целом ошибка "Failed to add from group" означает, что устройство не поддерживает кластер Groups. Я пытался добавить кнопку в группу.

Чтобы проверить наличие кластера Groups, надо зайти в устройство, во вкладку Clusters. И там в "Output Clusters" должен быть genGroups. Если genGroups нет, значит групповую адресацию кнопка не поддерживает. Для лампочек и led контроллеров genGroups должен быть как "Input Clusters"

vukitoso avatar Dec 02 '24 16:12 vukitoso

I had the same problem, after repairing some of the same lights. I removed the original group, re-created a new group with the same name.

Then, when trying to add the same lights into the new group I got the error.

After restarting Z2M is was fixed.

dschoorisse avatar Dec 21 '24 18:12 dschoorisse

Dupe of https://github.com/Koenkk/zigbee2mqtt/issues/23368

Gunni avatar Jan 09 '25 03:01 Gunni

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Mar 11 '25 00:03 github-actions[bot]

Not stale afaik

Gunni avatar Mar 11 '25 00:03 Gunni

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar May 11 '25 00:05 github-actions[bot]

Afaik nothing has changed

Gunni avatar May 11 '25 00:05 Gunni

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Jul 12 '25 00:07 github-actions[bot]

Not fixed afaik

Gunni avatar Jul 12 '25 00:07 Gunni

@Koenkk I'm returning to this issue after 10 months of first hitting it, now setting up a completely fresh install of homeassistant for a new house. I'm fairly confident that there are straightforward steps to reproduce:

Steps to Reproduce

  1. Create a new group.
  2. Delete that group.
  3. Create a new group with a different name than the first group.
  4. Attempt to add an existing device to this group.

Observe that we get an error:

2025-07-12 20:35:43z2m: Failed to add from group (DatabaseEntry with ID '63' does not exist)

When hitting this I had already created ~other groups successfully with no issues adding devices. I had never deleted a group.


Edit: I'm able to partially workaround this issue (and believe I did last year too) by renaming the broken group, creating a new group with my intended group name in Step 3. Now, when I add entities to the new group they get added to both the broken group and the correctly named group. Attempting to delete the broken group fails with a ID-does-not-exist. But this is close enough.

adamawolf avatar Jul 13 '25 03:07 adamawolf

Could you provide the debug log of the whole procedure?

See this on how to enable debug logging.

Koenkk avatar Jul 13 '25 06:07 Koenkk

I created a gist in debug-mode for you. I tried to delete most of the zh:ezsp:... sections, to keep it shorter. Let me know if you need the entire thing.

Flow:

  • I booted in debug-mode
  • Created a new group called MyNewGroup.
  • Added an Ikea bulb (Indkørsel - yderst)
  • Clicked to the overview of groups
  • Deleted the MyNewGroup-entry
  • Created a new group called MySecondNewGroup
  • Tried to add the same Ikea bulb

bakgaard avatar Sep 09 '25 21:09 bakgaard

@bakgaard thanks for the clear instructions and logging!

Fixed in https://github.com/Koenkk/zigbee2mqtt/pull/28583

Changes will be available in the dev branch in a few hours from now and in the next release which is every 1st of the month.

Koenkk avatar Sep 11 '25 18:09 Koenkk