Skip to content

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).

@Nerivec Nerivec mentioned this pull request Aug 1, 2025
5 tasks
@Koenkk Koenkk changed the base branch from master to fix/zhc-25 August 7, 2025 19:07
@Koenkk Koenkk merged commit 4041baa into fix/zhc-25 Aug 7, 2025
4 checks passed
@Koenkk Koenkk deleted the fix/refactor-onevent branch August 7, 2025 19:08
Koenkk added a commit that referenced this pull request Aug 10, 2025
SimplaHome pushed a commit to SimplaHome/zigbee-herdsman-converters that referenced this pull request Aug 15, 2025
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.

3 participants