Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(zigbee): Add endpoint identification in read handlers + command structures fix #11425

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

Merged
merged 4 commits into from
Jun 4, 2025

Conversation

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

@P-R-O-C-H-Y P-R-O-C-H-Y commented Jun 3, 2025

Description of Change

This pull request introduces significant updates to the Zigbee thermostat and Zigbee device handling codebase, focusing on enhancing functionality, improving clarity, and ensuring safer initialization of structures. Key changes include adding support for receiving temperature data with source information, updating device configuration handling, and initializing Zigbee command structures to prevent undefined behavior.

Tests scenarios

Tested using Thermostat + Temperature sensor examples.

Related links

Closes #11168

@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this Jun 3, 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 Jun 3, 2025
Copy link
Contributor

github-actions bot commented Jun 3, 2025

Messages
📖 🎉 Good Job! All checks are passing!

👋 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.
- 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 4eee08f

@P-R-O-C-H-Y P-R-O-C-H-Y moved this from Todo to In Review in Arduino ESP32 Core Project Roadmap Jun 3, 2025
Copy link
Contributor

github-actions bot commented Jun 3, 2025

Test Results

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

Results for commit 4eee08f.

♻️ This comment has been updated with latest results.

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 Zigbee endpoint functionality by adding source-aware temperature callbacks and expanding command methods to target groups, specific endpoints, and IEEE addresses, while also zero-initializing command structs to prevent undefined behavior.

  • Added onTempRecieveWithSource callback and updated zbAttributeRead signature to include source endpoint and address.
  • Introduced overloads for getTemperature, getSensorSettings, and setTemperatureReporting to support group, endpoint, and IEEE address targets.
  • Zero-initialized local Zigbee command structures across multiple endpoint implementations and updated example to demonstrate the new APIs.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libraries/Zigbee/src/ep/ZigbeeThermostat.h Added source-aware callback, new overloads for read/report methods.
libraries/Zigbee/src/ep/ZigbeeThermostat.cpp Implemented overloads, logging, zero-initialized structs, extended read handler.
libraries/Zigbee/src/ep/ZigbeeSwitch.cpp Zero-initialized esp_zb_zcl_on_off_cmd_t instances.
libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp Zero-initialized various ZCL command structs.
libraries/Zigbee/src/ZigbeeHandlers.cpp Forwarded new src_endpoint and src_address parameters.
libraries/Zigbee/src/ZigbeeEP.h Updated zbAttributeRead virtual signature.
libraries/Zigbee/src/ZigbeeEP.cpp Zero-initialized multiple read/report command structs.
libraries/Zigbee/examples/Zigbee_Thermostat/Zigbee_Thermostat.ino Updated endpoint macro, example logic for source callbacks and bound devices.
Comments suppressed due to low confidence (4)

libraries/Zigbee/src/ep/ZigbeeThermostat.h:37

  • [nitpick] The method name onTempRecieve is misspelled. Consider renaming to onTempReceive (and similarly _on_temp_recieve to _on_temp_receive) for correct spelling.
void onTempRecieve(void (*callback)(float)) {

libraries/Zigbee/src/ep/ZigbeeThermostat.cpp:119

  • Using a static local variable read_config in zbAttributeRead can cause race conditions when multiple endpoints or concurrent reads are processed. Consider making this state an instance member so it's scoped per object.
static uint8_t read_config = 0;

libraries/Zigbee/src/ep/ZigbeeThermostat.cpp:182

  • The macro ZB_ARRAY_LENTH appears misspelled. Confirm whether this should be ZB_ARRAY_LENGTH or correct the macro name to avoid compile errors.
read_req.attr_number = ZB_ARRAY_LENTH(attributes);

libraries/Zigbee/examples/Zigbee_Thermostat/Zigbee_Thermostat.ino:129

  • The example uses getBoundDevices() and printBoundDevices(), but these methods are not declared on ZigbeeThermostat. Either add these API methods to the class or remove/replace their usage in the example to ensure it compiles.
std::list<zb_device_params_t *> boundSensors = zbThermostat.getBoundDevices();

Copy link
Collaborator

@lucasssvaz lucasssvaz left a comment

Choose a reason for hiding this comment

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

LGTM

@me-no-dev me-no-dev added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Jun 4, 2025
@me-no-dev me-no-dev merged commit cae66e6 into master Jun 4, 2025
56 checks passed
@me-no-dev me-no-dev deleted the feat/zigbee-endpoint-identification branch June 4, 2025 14:40
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: Pending Merge Pull Request is ready to be merged
Projects
Development

Successfully merging this pull request may close these issues.

Support Endpoint Identification from Multiple Zigbee Devices
3 participants