Skip to content
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

feat: Zigbee Specification revamp #1042

Merged
merged 41 commits into from
May 12, 2024
Merged

feat: Zigbee Specification revamp #1042

merged 41 commits into from
May 12, 2024

Conversation

Nerivec
Copy link
Collaborator

@Nerivec Nerivec commented May 1, 2024

  • Move zcl into zspec folder.
  • Add first draft for ZDO specification [R23]. This PR doesn't introduce its usage, it needs extensive testing/tweaking before it can be refactored in.
  • Add ZCL-specific test (independent of higher-level herdsman logic).
  • Reorganized imports/exports for zspec
    • consts/enums will now be automatically exported whenever new ones are added in their respective places.
    • import {ZSpec, Zcl, Zdo} from 'zigbee-herdsman'
    • Zigbee consts => ZSpec.ZIGBEE_REVISION
    • Zigbee enums => ZSpec.BroadcastAddress.RX_ON_WHEN_IDLE
    • Zigbee util functions => ZSpec.Utils.channelsToUInt32Mask()
    • ZDO consts => Zdo.ZDO_ENDPOINT
    • ZDO enums => Zdo.LeaveRequestFlags.WITHOUT_REJOIN
    • ZDO util functions => Zdo.Utils.getServerMask()
    • ZDO status/error => Zdo.Status.SUCCESS and new Zdo.StatusError(Zdo.Status.INV_REQUESTTYPE)
    • ZCL consts => Zcl.POWER_SOURCES
    • ZCL enums => Zcl.DataType.UINT8
    • ZCL util functions => Zcl.Utils.isClusterName()
    • ZCL status/error => Zcl.Status.SUCCESS and new Zcl.StatusError(Zcl.Status.FAILURE)
    • ZCL frame => Zcl.Frame
    • ZCL header => Zcl.Header
  • Add enums: ParameterCondition, DataTypeClass and replace hardcoded strings in Clusters/Foundation.
  • Fix typing for ParameterDefinition, and more...
  • Extract Xiaomi workaround from CHAR_STR to its own data type MI_STRUCT.
  • Add several basic consts that should eventually replace hardcoded stuff throughout the code. Can be swapped when encountered in future PRs. More can be added as needed.
  • Added several basic Zigbee types as "more informative" wrappers for Typescript types. Same as above.

TODO:

@Nerivec
Copy link
Collaborator Author

Nerivec commented May 2, 2024

@Koenkk If you can review this commit in great details. It drastically changes the code for clusters/custom clusters lookup. We need to make sure it still matches the way you designed custom clusters to be (i.e. that tests aren't testing this wrong). 😅
If it does, these changes have one heck of a nice side-effect:

x10000 getCluster:
Old: ~280ms
New: ~50ms

x10000 getCluster with 2 custom clusters:
Old: ~7.5s
New: ~57ms

@Nerivec Nerivec marked this pull request as ready for review May 5, 2024 18:35
@Koenkk Koenkk merged commit 7316247 into Koenkk:master May 12, 2024
1 check passed
@Koenkk
Copy link
Owner

Koenkk commented May 12, 2024

Thanks!

@Nerivec Nerivec deleted the zspec branch May 12, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants