Koenkk / zigbee-herdsman

A Node.js Zigbee library
MIT License
454 stars 278 forks source link

Support custom clusters #1019

Closed Koenkk closed 2 weeks ago

Koenkk commented 3 weeks ago

Requires https://github.com/Koenkk/zigbee-herdsman/pull/1011, implements https://github.com/Koenkk/zigbee-herdsman/pull/971

liubotongs commented 3 weeks ago

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 commented 3 weeks ago

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 commented 2 weeks ago

Ready for review!

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

sjorge commented 2 weeks ago

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 commented 2 weeks ago

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

sjorge commented 2 weeks ago

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.

sjorge commented 2 weeks ago

LGTM

sjorge commented 2 weeks ago

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 commented 2 weeks ago

Created a PR to use the custom cluster for sonoff devices https://github.com/Koenkk/zigbee-herdsman-converters/pull/7432 🥳