Skip to content

feat(zigbee): Check the type of leave signal #11385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

P-R-O-C-H-Y
Copy link
Member

Description of Change

This pull request updates the esp_zb_app_signal_handler function in ZigbeeCore.cpp to enhance the handling of Zigbee network leave signals. It introduces new logic to differentiate between leave types (with or without rejoin) and adds appropriate actions for each scenario.

Tests scenarios

Tested just the leave without rejoin to make sure, this addition is not breaking current code.
@tofurky please give it a try in long term and send feedback.

Related links

Closes #11381

@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this May 21, 2025
@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Review needed Issue or PR is awaiting review Area: Zigbee Issues and Feature Request about Zigbee labels May 21, 2025
Copy link
Contributor

github-actions bot commented May 21, 2025

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Update libraries/Zigbee/src/ZigbeeCore.cpp":
    • summary looks empty
    • type/action looks empty
  • the commit message "Update libraries/Zigbee/src/ZigbeeCore.cpp":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

👋 Hello P-R-O-C-H-Y, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against af9b642

@P-R-O-C-H-Y P-R-O-C-H-Y requested a review from Copilot May 21, 2025 08:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Zigbee leave signal handler to distinguish between leave-with-reset and leave-with-rejoin events, triggering a factory reset or device reboot accordingly.

  • Introduces leave_params to inspect the leave type.
  • Logs leave type and executes factoryReset for non-rejoin leaves.
  • Reboots the device on leave-with-rejoin signals.
Comments suppressed due to low confidence (1)

libraries/Zigbee/src/ZigbeeCore.cpp:383

  • Add a test case covering the leave-with-rejoin path to validate the ESP.restart() behavior, as current tests only cover the reset scenario.
else { // Leave with rejoin -> Rejoin the network, only rebooot the device

P-R-O-C-H-Y and others added 2 commits May 21, 2025 10:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Test Results

 76 files   76 suites   13m 50s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit af9b642.

@tofurky
Copy link

tofurky commented May 21, 2025

Thanks @P-R-O-C-H-Y looks good, I've reflashed with this change applied to 3.2.0 (wound up being .arduino15/internal/esp32_esp32_3.2.0_5be222ba8658a6b6/libraries/Zigbee/src/ZigbeeCore.cpp locally w/arduino-cli).

Having a couple log_i() like this will be helpful to see when this occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Zigbee Issues and Feature Request about Zigbee Status: Review needed Issue or PR is awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zigbee end device "randomly" factory resets; seems due to handling of ESP_ZB_ZDO_SIGNAL_LEAVE
3 participants