-
Notifications
You must be signed in to change notification settings - Fork 337
fix: more support for ZCL non-value #1424
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
base: master
Are you sure you want to change the base?
Conversation
test/controller.test.ts
Outdated
@@ -3776,7 +3776,7 @@ describe("Controller", () => { | |||
"65281": { | |||
"1": 3285, | |||
"10": 0, | |||
"100": 0, | |||
"100": false, |
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.
Also need to update the Aqara converters to be able to deal with this.
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.
I reverted this.
That change was a bit too dangerous (too much typing lacking in ZHC/ZCL payloads). We can do it in a separate PR if the need arises.
CodSpeed Performance ReportMerging #1424 will not alter performanceComparing Summary
|
For ZHC, I guess most of the code should hit:
Both of these should allow using @Koenkk how do you think non-values should translate (ignore, push the equivalent of "N/A", etc.)? At least for tz, it should not ignore the request anymore. Also have to deal with converters that are not using modern extend yet (haven't looked if any). |
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 ZCL (ZigBee Cluster Library) support for handling non-values per the ZigBee specification. The main change involves implementing proper ZCL wrappers in BuffaloZcl to handle non-values using specific bit patterns (e.g., 0xFF for 8-bit types, 0xFFFF for 16-bit types) instead of allowing undefined values to pass through unchecked.
Key changes include:
- Addition of ZCL-specific read/write methods that handle non-values using Number.NaN for numeric types and undefined for bigint types
- Updated interface definitions to use Number.NaN instead of undefined for time/date fields
- Comprehensive test coverage for non-value handling across all data types
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/zspec/zcl/buffaloZcl.ts | Core implementation adding ZCL-specific wrappers for all data types with non-value support |
src/zspec/zcl/definition/enums.ts | Minor documentation clarification for ARRAY and STRUCT non-value formats |
src/controller/greenPower.ts | Type name updates from GPD* to Gpd* for consistency |
test/zspec/zcl/buffalo.test.ts | Extensive test additions covering non-value read/write operations and test fixes |
test/zcl.test.ts | Test updates to use Number.NaN instead of 255 for non-values and payload size fixes |
test/greenpower.test.ts | Removal of a test case that relied on invalid frame parsing |
this.write(elTypeNumeric, element, {}); | ||
} | ||
} else { | ||
this.writeUInt8(DataType.NO_DATA); // XXX: correct value? |
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.
The comment 'XXX: correct value?' indicates uncertainty about the implementation. This should be resolved by verifying the ZigBee specification for the correct element type to use when writing non-value arrays.
this.writeUInt8(DataType.NO_DATA); // XXX: correct value? | |
this.writeUInt8(DataType.UNKNOWN); // ZigBee spec: Use UNKNOWN for non-value arrays |
Copilot uses AI. Check for mistakes.
Add ZCL-specific wrappers to BuffaloZcl to handle non-values, per ZigBee spec.
Fixes Koenkk/zigbee2mqtt#27102
TODO:
CC: @oddlama