Dynamic protocols switching#113
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Zigbee+Matter coexistence runtime to support user-triggered protocol switching (via long button press) and adds configuration options for (a) choosing the default protocol on factory-fresh boot and (b) optionally avoiding Matter BLE commissioning advertisement while Zigbee is active.
Changes:
- Add Kconfig-controlled default protocol selection on first boot (before any persisted state exists).
- Add coexistence options and APIs for long-press protocol switching and for gating the “Matter ready” signal (BLE-advertising event vs explicit app signal).
- Track “Zigbee commissioning/join active” state to block protocol switching during commissioning operations.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| subsys/lib/zigbee_matter_protocol_state/matter_protocol_state.c | Applies a configurable default protocol when no persisted state is present. |
| subsys/lib/zigbee_matter_protocol_state/Kconfig | Adds a choice for selecting the default protocol on first boot. |
| subsys/lib/zigbee_matter_coexistence/Kconfig | Adds options for BLE commissioning while Zigbee is active and for button-based protocol switching. |
| subsys/lib/zigbee_matter_coexistence/coexistence.cpp | Implements long-press switch handling, Zigbee reboot switch path, and “Matter init done” signaling. |
| subsys/lib/zigbee_app_utils/zigbee_app_utils.c | Introduces a global commissioning-active flag and integrates it into commissioning/rejoin flows. |
| samples/light_switch/src/app_task.cpp | Signals Matter board init completion to coexistence runtime when BLE-based signaling is disabled. |
| samples/light_switch/src/app_task_zigbee.c | Adds long-press switch button handling and commissioning tracking for Touchlink initiation. |
| samples/light_switch/prj_matter_fota.conf | Enables coexistence runtime logging level in the sample config. |
| samples/light_bulb/src/app_task_zigbee.cpp | Adds long-press switch button handling for the Zigbee button callback path. |
| samples/light_bulb/src/app_task_matter.cpp | Signals Matter board init completion to coexistence runtime when BLE-based signaling is disabled. |
| samples/light_bulb/prj_matter_fota.conf | Enables coexistence runtime logging level in the sample config. |
| include/zigbee/zigbee_app_utils.h | Exposes commissioning-active query/set APIs for samples and runtime coordination. |
| include/zigbee/matter_protocol_state.h | Updates module documentation to reference configurable first-boot default behavior. |
| include/zigbee/matter_coexistence.h | Adds new coexistence APIs and updates documentation for Matter-init signaling and button switching. |
Comments suppressed due to low confidence (1)
samples/light_switch/src/app_task_zigbee.c:270
zigbee_network_join_commissioning_set_active(true)is set before starting Touchlink commissioning, but ifbdb_start_top_level_commissioning()rejects the request the flag is never restored/cleared. This can leave the global commissioning-active state stuck true.
zigbee_network_join_commissioning_set_active(true);
zigbee_touchlink_initiator_prepare_scan_channels();
if (!bdb_start_top_level_commissioning(ZB_BDB_TOUCHLINK_COMMISSIONING)) {
LOG_WRN("Touchlink commissioning rejected (already in progress?)");
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Documentation PreviewThe documentation has been built successfully. You can view the preview here: preview Generated at: Expand to view changed pages
|
ArekBalysNordic
left a comment
There was a problem hiding this comment.
Overall lgtm, some comments to consider.
Add an atomic flag set while top-level BDB commissioning runs so coexistence can block protocol switches during join without treating idle unjoined devices as always pairing. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Wire coexistence button handling on the light switch and light bulb combined samples. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Let combined builds choose Zigbee or Matter as the initial protocol when no persisted settings entry exists yet. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
d17cfd3 to
317c773
Compare
Document the behavior of `CONFIG_ZIGBEE_MATTER_PROTOCOL_STATE_DEFAULT_PROTOCOL` and `CONFIG_ZIGBEE_MATTER_COEXISTENCE_BUTTON_SWITCH`. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
317c773 to
14d6768
Compare
Add the option to switch between Matter and Zigbee (and vice-versa) on a long button press.
Also allow to disable Matter commissioning advertisement while Zigbee is running.
TODO: