Skip to content

fix!: Refactor onEvent #9650

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

fix!: Refactor onEvent #9650

wants to merge 11 commits into from

Conversation

Koenkk
Copy link
Owner

@Koenkk Koenkk commented Jul 19, 2025

This PR refactors the onEvent:

  • Added proper typing for the event data
  • Removed the message onEvent event, existing usages have been refactored to fromZigbee converters
  • Removed a lot of duplicated code; e.g.:
    • There is now a modernExtend available for polling, code which was previously often duplicated.
    • Cleaned a lot of Tuya code

This is a breaking change, clients have to update the onEvent calls according to the new types and have to make sure that the start event is always emitted before any other event on the definition.onEvent().

To be merged together with #9693 to prevent 2 breaking change releases in a row.

TODO:

@Koenkk Koenkk marked this pull request as draft July 19, 2025 20:29
@Koenkk Koenkk marked this pull request as ready for review July 26, 2025 18:12
@Koenkk Koenkk requested a review from Nerivec July 26, 2025 18:12
@Nerivec
Copy link
Collaborator

Nerivec commented Jul 26, 2025

And merge with Koenkk/zigbee-herdsman#1459 & #9679 too for break grouping 😬

deviceExposesChanged: () => void;
}
export namespace OnEvent {
export type BaseData = {device: Zh.Device; deviceExposesChanged: () => void; state: KeyValue; options: KeyValue};
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about naming this DeviceData to avoid confusion? (Also fits with the fact it's only used when the event is device[...].)

@Koenkk
Copy link
Owner Author

Koenkk commented Jul 26, 2025

And merge with Koenkk/zigbee-herdsman#1459 & #9679 too for break grouping 😬

With breaking I meant the zhc api breaking (causing a new major zhc release), AFAIK #9679 doesn't break the zhc api?

@Nerivec
Copy link
Collaborator

Nerivec commented Jul 26, 2025

External converters could be using the cluster name (it's the ZH part that's technically breaking though).

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