-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Conversation
👋 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 ...
Review and merge process you can expect ...
|
Test Results 76 files 76 suites 13m 1s ⏱️ Results for commit 4eee08f. ♻️ This comment has been updated with latest results. |
There was a problem hiding this 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 updatedzbAttributeRead
signature to include source endpoint and address. - Introduced overloads for
getTemperature
,getSensorSettings
, andsetTemperatureReporting
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 toonTempReceive
(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
inzbAttributeRead
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 beZB_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()
andprintBoundDevices()
, but these methods are not declared onZigbeeThermostat
. 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();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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