-
Notifications
You must be signed in to change notification settings - Fork 4k
fix: adjust to new typing from ZH, fix discovered issues #9779
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
|
@Koenkk can you take a look at the few remaining errors? Some legacy stuff, and a few weird occurrences. |
57089b3 to
24baaa2
Compare
| } | ||
| await entityToUse.read(cluster, [keyToUse], { | ||
| // XXX: far too dynamic to properly type | ||
| await entityToUse.read(cluster, [keyToUse] as Parameters<typeof entityToUse.read>[1], { |
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.
@rohankapoorcom in case you have some time to look this over, don't need to include changes in this PR, but would be nice if we could type this better in the future. Seems a lot of Inovelli code is very dynamic, which is good for size, but very hard to properly type (i.e. more dangerous).
The base would be to have statically-defined cluster name and attribute name (not dynamically generated with string manipulation & co) whenever there are calls to ZH, which would allow to use the new typing introduced in ZH and used elsewhere in this PR.
Note: a little manipulation is doable (example) but more advanced stuff like split, etc. breaks down typing to plain string which we can't validate against cluster types.
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 adjusts to new typing from zigbee-herdsman (ZH) and fixes multiple discovered issues across the codebase. The primary purpose is to adapt the codebase to stricter type safety from ZH updates while fixing various bugs found during this process.
Key changes:
- Update type imports and interface definitions to match new ZH typing system
- Fix multiple attribute names, payload formats, and command structures
- Enhance type safety with custom cluster definitions and proper type annotations
Reviewed Changes
Copilot reviewed 70 out of 71 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/tuya.test.ts | Reorder import statement for type consistency |
| src/lib/utils.ts | Add type imports and enhance function signatures with generics for better type safety |
| src/lib/ubisys.ts | Add custom cluster interfaces and improve type annotations throughout |
| src/lib/types.ts | Update Tuya DpValue data field type from union to Buffer |
| src/lib/tuya.ts | Fix data type conversions to use Buffer consistently and improve type safety |
| src/lib/sunricher.ts | Add custom cluster interfaces and fix type annotations |
| src/lib/reporting.ts | Add type imports and enhance payload function with generics |
| src/lib/philips.ts | Add custom cluster interface and improve type safety |
| src/lib/nodon.ts | Add custom cluster interface and enhance type annotations |
| src/lib/namron.ts | Fix payload format issues and improve type annotations |
| src/lib/modernExtend.ts | Major updates to add generic type parameters throughout and improve type safety |
| src/lib/lumi.ts | Update function signatures with proper generic types |
| src/lib/light.ts | Add type imports and improve function parameter types |
| src/lib/legrand.ts | Fix attribute value format issues and improve type safety |
| src/lib/legacy.ts | Fix command structure and remove unnecessary type conversions |
| src/lib/ikea.ts | Add custom cluster interfaces and improve type annotations |
| src/lib/generateDefinition.ts | Remove unnecessary generic type parameters |
| src/lib/ewelink.ts | Add type imports and fix command structures |
| src/lib/develco.ts | Add custom cluster interfaces and improve type annotations |
| src/devices/yokis.ts | Add comprehensive custom cluster interfaces and fix command structures |
| src/devices/yandex.ts | Add custom cluster interfaces and improve type safety |
| src/devices/xyzroe.ts | Fix attribute name and improve type annotations |
| src/devices/wirenboard.ts | Add custom cluster interface and improve type safety |
| src/devices/ubisys.ts | Add type imports and enhance read/write operations with proper typing |
| src/devices/tuya.ts | Add custom cluster interface and fix command structures |
| src/devices/tubeszb.ts | Fix attribute type annotation |
| src/devices/sunricher.ts | Add custom cluster interfaces and improve type annotations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
|
I reverted the tsconfig |
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Koen Kanters <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Koen Kanters <[email protected]>
Requires Koenkk/zigbee-herdsman#1479
TODO:
toZigbee.light_color, in-depth review neededand a few more in the code itself
TODO (separate PRs):
validateValue? (could remove quite a fewas "x" | "y"likeas "toggle" | "off" | "on"globalStore.getValueis typed asany, should refactorDiscovered issues
toZigbee.danfoss_heat_supply_requestwrong attribute nametimeHHMMfzLocal.ct_direction&tzLocal.ct_directiontzLegrand.calibration_modetoZigbee.namron_edge_thermostat_vacation_datetoZigbee.namron_edge_thermostat_holiday_tempfrom commands typing:
cover_via_brightnessusing invalid value type in commandfan_speedusing invalid value type in commandtwinguardSmokeDetectorinitiateTestModecommand missing payload (was using manuf opts in place, i.e. manuf opts were ignored)twinguardSetuppairingCompletedcommand missing payload (was using manuf opts in place, i.e. manuf opts were ignored)manuSpecificYokisDeviceopenNetworkusing improper casing in command namemanuSpecificYokisInputsendPressusing improper custom cluster namemanuSpecificYokisInputsendReleaseusing improper custom cluster namemanuSpecificYokisInputselectInputModeusing improper custom cluster name