Native scene recall fails to update overlapping Zigbee group states despite individual member states updating correctly

Open
#33,924 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Start with the lastOptimisticState handling in lib/extension/groups.ts, the area identified in the issue, and trace how native scene recalls and overlapping group updates publish state. Compare the cached optimistic state with the published state during the reproduction steps. Done means all affected overlapping group states match their individual members after both ON and OFF scene recalls; the issue reports no failing test or debug log, so first identify or add a focused reproduction.

Written by the indexing model from the issue text.

Description

problem
What happened?

Following discussion in #33910, I was advised to raise a separate issue for this behaviour.

When recalling a native Zigbee scene on a group containing devices that also belong to other groups, the individual device states update correctly, but the overlapping groups intermittently retain their previous states.

My setup consists of a main Kitchen group containing 26 lights, with several smaller groups sharing those same devices.

For example, after recalling a native OFF scene, the following states were recorded:

Group Individual devices reporting OFF Reported group state
Kitchen 26/26 OFF
Kitchen Spots 11/11 ON
Kitchen Island 3/3 ON
Apex Ceiling 3/3 ON
Apex Party 5/5 ON

All 26 individual devices correctly reported OFF, but every overlapping subgroup incorrectly remained ON.

The issue also occurs in the opposite direction when recalling an ON scene from an OFF state.

The physical lights respond correctly. The issue concerns the reported state of overlapping groups.

Standard group ON/OFF commands correctly update the overlapping groups in my testing.

The behaviour has been reproduced using freshly created scenes and after upgrading coordinator firmware.

What did you expect to happen?

When a native scene is recalled, all groups containing affected devices should have their states updated consistently with their individual members and configured off_state behaviour.

If every member of a group reports OFF, the group should report OFF.

If every member of a group reports ON, the group should report ON.

The resulting group states should be consistent regardless of whether the devices were controlled through individual commands, standard group commands or native scene recall.

How to reproduce it (minimal and precise)
  1. Create a Zigbee group (Group A) containing multiple lights.

  2. Create two additional Zigbee groups (Group B and Group C), each containing different subsets of the devices also belonging to Group A.

  3. Store two native scenes on Group A:

    • Scene 0: All lights OFF
    • Scene 16: All lights ON
  4. Recall Scene 16 to establish an ON state.

  5. Turn Group A OFF using a standard group command:

    Topic: zigbee2mqtt/Kitchen/set
    Payload: {"state":"OFF"}

  6. Turn Group B ON and then OFF directly, leaving Group C untouched.

  7. Recall Scene 16 on Group A:

    Topic: zigbee2mqtt/Kitchen/set
    Payload: {"scene_recall":16}

  8. Compare the reported states of Group B and Group C against their individual members.

In my controlled testing:

  • All individual devices reported ON.
  • Group B, which had been directly toggled, correctly reported ON.
  • Group C, which had remained untouched, incorrectly reported OFF.

Repeating this test with four overlapping subgroups resulted in only the directly toggled subgroup updating correctly.

As a control test, replacing the scene recall command with a standard group ON command resulted in all overlapping groups updating correctly.

The issue can also be reproduced in the opposite direction by recalling Scene 0 after establishing an ON state.

Repeated cycles may be required to reproduce the behaviour.

Zigbee2MQTT version

2.14.4

Adapter firmware version

Nerivec EmberZNet 9.1.2 [GA] – v2026.6.2-pre1

Adapter

SONOFF Dongle Max (Dongle-M) – EFR32MG24 – Ember – 460800 baud – Ethernet

Setup

Zigbee2MQTT running as a Home Assistant add-on.

Hardware: Dell Wyse 5070
CPU: Intel Pentium Silver J5005
RAM: 8 GB

Coordinator: SONOFF Dongle Max (Dongle-M)
Connection: Ethernet (TCP)
Adapter: ember
Firmware: Nerivec 9.1.2
Baudrate: 460800

The network contains multiple overlapping Zigbee groups.

The affected Kitchen group contains 26 lights, including IKEA lighting devices.

The smaller groups are separate native Zigbee2MQTT groups sharing member devices with the larger Kitchen group.

Scenes have been recalled both directly through the Zigbee2MQTT frontend and through MQTT commands from Home Assistant.

Device database.db entry

N/A – This issue concerns group state propagation across multiple devices and groups.

Debug log

No corresponding errors or warnings were observed in the Zigbee2MQTT notifications during the latest reproduction.

The following is a summary of timestamped Home Assistant state history from a controlled test on 3 December 2026.

22:46:59 – Standard group ON command

  • All 26 devices ON
  • All four overlapping subgroups ON

22:49:21 – Native Scene 0 recalled

  • All 26 individual devices changed to OFF
  • Main Kitchen group changed to OFF
  • Kitchen Spots remained ON
  • Kitchen Island remained ON
  • Apex Ceiling remained ON
  • Apex Party remained ON

22:50:29 – Native Scene 16 recalled

  • All 26 individual devices changed to ON
  • Main Kitchen group changed to ON
  • All four overlapping subgroups remained ON throughout the entire sequence, with no recorded OFF transition.

Full Zigbee2MQTT debug logs can be provided if required.

Notes

Related issue: #33910

The original issue also included Ember multicast registration errors. These appear to have been resolved by upgrading to Nerivec firmware 9.1.2, as recommended by @andrei-lazarov.

However, the overlapping group state issue remains independently reproducible.

Troubleshooting already undertaken:

  • Tested coordinator firmware 7.4.5, 8.2.2 and Nerivec 9.1.2.
  • Deleted and recreated both native ON and OFF scenes.
  • Created a new test group containing identical members to an existing group.
  • Verified individual device states against group states using timestamped Home Assistant history.
  • Compared native scene recall with ordinary group commands.
  • Performed controlled testing where one overlapping subgroup was directly toggled before scene recall whilst the remaining subgroups were left untouched.

Possible area for investigation:

In lib/extension/groups.ts, the lastOptimisticState mechanism appears to suppress duplicate optimistic group state publications.

Directly controlling a group invalidates its cached optimistic state. However, when an overlapping group is updated indirectly through another group's command, it appears possible for its cached optimistic state to become inconsistent with its published state.

A subsequent native scene recall may therefore result in a legitimate group state update being suppressed because the incoming payload matches the previous cached optimistic state, despite the group's currently published state being different.

This is a hypothesis based on the observed behaviour and source code, rather than a confirmed root cause.

The groups.ts implementation was compared between release 2.14.4 and the dev branch and appeared identical at the time of investigation. I have not run the dev branch on my production network.

Happy to provide further debug logs or undertake additional controlled testing.

Dominant language
TypeScript
Stars
15.9k
Forks
2.1k
Avg merge
12h 11m
Merged PRs (30d)
32

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Koenkk/zigbee2mqtt

All issues in Koenkk/zigbee2mqtt

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.