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

Support custom clusters #1019

Merged
merged 11 commits into from
Apr 23, 2024
Merged

Support custom clusters #1019

merged 11 commits into from
Apr 23, 2024

Conversation

Koenkk
Copy link
Owner

@Koenkk Koenkk commented Apr 14, 2024

Requires #1011, implements #971

@Koenkk Koenkk requested a review from Nerivec April 14, 2024 20:40
@Koenkk Koenkk marked this pull request as draft April 14, 2024 20:40
Copy link
Contributor

@sjorge sjorge left a comment

Choose a reason for hiding this comment

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

I'll try to give this a closer look later, seems a lot more involved than I originally expected it to be. Which was already pretty involved 😅

src/zcl/utils.ts Show resolved Hide resolved
Base automatically changed from fix/from-buffer-refactor to master April 15, 2024 19:44
@liubotongs
Copy link

OK, what I've learned is that the custom cluster needs to be injected at the Device Level. Can you provide an example to help people like me who are not familiar with Z2M better understand? Thank you!

@LaurentChardin
Copy link

OK, what I've learned is that the custom cluster needs to be injected at the Device Level. Can you provide an example to help people like me who are not familiar with Z2M better understand? Thank you!

@liubotongs This is really work in progress so far. I believe you need to wait a bit before the full setup is explained by the devs as they are just in the process to implement it. Especially if you are not yet familiar with z2m, better wait for official documentation.

@Koenkk Koenkk marked this pull request as ready for review April 22, 2024 19:24
@Koenkk Koenkk requested review from sjorge and Nerivec April 22, 2024 19:37
@Koenkk
Copy link
Owner Author

Koenkk commented Apr 22, 2024

Ready for review!

These 2 tests show the API, the idea is that you can use this from the zhc definition onEvent().

@sjorge
Copy link
Contributor

sjorge commented Apr 22, 2024

It's a bit late so I'll give this a proper look tomorrow (if I am home on time)

So the idea is to inject them via the onEvent every time the device sends a message ? If so, how did we inject them before we send a message?

@Koenkk
Copy link
Owner Author

Koenkk commented Apr 22, 2024

onEvent is also called when device interview completes and z2m starts (type == 'start' || type == 'deviceInterview')

@sjorge
Copy link
Contributor

sjorge commented Apr 22, 2024

onEvent is also called when device interview completes and z2m starts (type == 'start' || type == 'deviceInterview')

Ah that makes more sense, when this is merged I'll use it to fix the vindstyrka, I'll make a generic modernExtend for it and then it will be nicely abstracted.

src/zcl/zclFrame.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@sjorge sjorge left a comment

Choose a reason for hiding this comment

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

I'm less confident on my understanding of the inner workings of ZH, I certainly could not have implemented this myself.

But after going over the changes they seem to make sense. I do think I found one bug that I flagged, I also left a note for myself for when I will start using this.

I also have a question that popped in my head whole going over the code and thinking about how I would use it.

Currently the frontend seems to somehow gather the cluster, attribute info for the reporting, binding and dev tabs from it's dependency on zh. I think this somehow will also need to be changed in some way so that it can query the 'cluster.attribute' view a device has. Otherwise it will IIRC from experience, revert back to numeric displays of the cluster and attribute. Which is probably not very user friendly.

src/controller/model/device.ts Outdated Show resolved Hide resolved
src/zcl/definition/tstype.ts Show resolved Hide resolved
@sjorge
Copy link
Contributor

sjorge commented Apr 23, 2024

LGTM

@Koenkk Koenkk merged commit cebf57e into master Apr 23, 2024
2 checks passed
@Koenkk Koenkk deleted the feat/custom-clusters branch April 23, 2024 20:17
@sjorge
Copy link
Contributor

sjorge commented Apr 23, 2024

I have a bit of time this weekend, so I'll take a go at adding a modernExtend to add a cluster/override a cluster so I can fix the vindstyrke.

Koenkk added a commit that referenced this pull request Apr 23, 2024
* Support custom clusters

* WIP

* updates

* updates

* updates

* update

* updates

* Process feedback

* fix lint
@Koenkk
Copy link
Owner Author

Koenkk commented Apr 23, 2024

Created a PR to use the custom cluster for sonoff devices Koenkk/zigbee-herdsman-converters#7432 🥳

LaurentChardin added a commit to LaurentChardin/zigbee-herdsman that referenced this pull request Apr 23, 2024
…ent for testing. But will probably not do a PR to origin repo if this is ok, and only work in ZHC. Pending changes to happen in frontend part too
LaurentChardin added a commit to LaurentChardin/zigbee-herdsman-converters that referenced this pull request Apr 23, 2024
LaurentChardin pushed a commit to LaurentChardin/zigbee-herdsman that referenced this pull request Apr 26, 2024
…ent for testing. But will probably not do a PR to origin repo if this is ok, and only work in ZHC. Pending changes to happen in frontend part too
LaurentChardin pushed a commit to LaurentChardin/zigbee-herdsman-converters that referenced this pull request Apr 26, 2024
Adding attributes for manuSpecificYokisLightControl and new commands: moveToPosition and LongOn.
Updating logger to latest changes. Adding additional missing command definition
Some eslint cleaning
Some cleaning and deactivating some clusters as we are pending firmware fix
Migrating Custom cluster definition after Koenkk/zigbee-herdsman#1019.
Adding some types
Fix for default package zigbee-herdsman
LaurentChardin pushed a commit to LaurentChardin/zigbee-herdsman-converters that referenced this pull request Apr 26, 2024
Adding attributes for manuSpecificYokisLightControl and new commands: moveToPosition and LongOn.
Updating logger to latest changes. Adding additional missing command definition
Some eslint cleaning
Some cleaning and deactivating some clusters as we are pending firmware fix
Migrating Custom cluster definition after Koenkk/zigbee-herdsman#1019.
Adding some types
Fix for default package zigbee-herdsman
Koenkk added a commit that referenced this pull request Apr 28, 2024
* feat: Add optional `inclSleepyZED` parameter

* feat: Add `inclSleepyZED` to z-stack

* feat: Add `inclSleepyZED` to ezsp

* feat: Add `inclSleepyZED` to zigate

* feat: Add `inclSleepyZED` to ember

* feat: Add `inclSleepyZED` to deconz

* fix: Add test for z-stack

* fix: Additional test for z-stack

* Support custom clusters (#1019)

* Support custom clusters

* WIP

* updates

* updates

* updates

* update

* updates

* Process feedback

* fix lint

* fix: Add `destinationBroadcastAddress`

* Update zStackAdapter.ts

* Update emberAdapter.ts

* Update ezspAdapter.ts

* Update zigateAdapter.ts

* Update deconzAdapter.ts

* Update adapter.ts

* Add broadcast ability from device. Add `zspec` folder.

* Rename `triggerBroadcast` to `broadcastCommand`

* Get `manufacturerCode` from provided `clusterKey`

* Get cluster from `clusterKey`

* Test for specific`manufacturerCode`

* Refactor `broadcastCommand` based on `zclCommand`

* Add missing `Options` interface

* Updates

* Feedback update.

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
Co-authored-by: Nerivec <62446222+Nerivec@users.noreply.github.com>
@liubotongs
Copy link

When I updated Z2M 1.37.0 to version 1.37.1, the ZBMicro device of sonoff.js still had the problem that custom clusters 64529 did not exist, but it was normal in the previous version 1.37.0. Can you tell me what's going on here? What are the solutions? For example, version rollback. thank you.

@liubotongs
Copy link

When I updated Z2M 1.37.0 to version 1.37.1, the ZBMicro device of sonoff.js still had the problem that custom clusters 64529 did not exist, but it was normal in the previous version 1.37.0. Can you tell me what's going on here? What are the solutions? For example, version rollback. thank you.

It seems that sonoff.js in zigbee-herdsman-converters has not been updated using the latest version.

@LaurentChardin
Copy link

Can you check with version of ZHC you have if your installation ? This was added 2 weeks ago as part as release 19.38.0

@Chilli-liu
Copy link

zigbee-herdsman-converters

I found that the ZHC version under my current Z2M is 19.37.2. How do I individually update the ZHC version to the latest version? Thank you!
zigbee2mqtt@1.37.1 /opt/zigbee2mqtt
└── zigbee-herdsman-converters@19.37.2 overridden

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.

6 participants