zigpy / zigpy-zigate

A library which communicates with ZiGate radios for zigpy
GNU General Public License v3.0
29 stars 18 forks source link

How is the data of zdo and zcl sent and received? #143

Open lbuque opened 1 year ago

lbuque commented 1 year ago

We received this request.

I'm learning how zigpy works?

How is the data of zdo and zcl sent and received?

puddly commented 1 year ago

Zigpy expects low-level access to the stack. Radio libraries are expected to implement only a few methods:

That being said, it seems that your radio is based on the TLSR8258 chip. Is there any widely-available USB stick using this chip? If not, there is not going to be much of a benefit to writing a new radio library when we already have good support for CC2652, EFR32, and Conbee chips.


@Hedda I appreciate your enthusiasm but please do not recruit developers to write new radio libraries without first consulting with the zigpy team.

The maintenance burden of the existing legacy zigpy radio libraries is significant. Adding yet another radio type will not help with Zigbee adoption when we already have five to choose from, it will just increase the amount of time it takes to make changes to zigpy.

AskAlice commented 1 year ago

stubled across this thread 👀

Doing a little digging I see zigpy is mostly used for coordinators, but could it be used in a device context? Communicating with the esp32 of a ttgo t-zigbee over serial, then relaying that over to another zigpy-controlled device (z2m or zha) ?

If there were a method of abstracting away the zigbee radio's firmware it could greatly improve the developer experience with working with these boards. For me, i'm kind of running into a brick wall at the moment because the sdk provided by telink only gives examples of firmware that works within the limits of the zigbee alliance's specification, which leaves me fairly in the dark about how to implement custom messaging that doesn't conform to ZCL or ZDO.

puddly commented 1 year ago

Doing a little digging I see zigpy is mostly used for coordinators, but could it be used in a device context?

Totally, but only if the firmware can be configured to join a network. There's no standard zigpy API for this since we have never needed to do it. I believe the EmberZNet and ZNP coordinators can be configured to join a network as a router but I have not tried it in a very long time.

which leaves me fairly in the dark about how to implement custom messaging that doesn't conform to ZCL or ZDO.

Custom messaging can be implemented with ZCL if you define a manufacturer-specific cluster with manufacturer-specific commands. You'd just have the overhead of the ZCL header, which is just a couple of bytes. No reason not to use ZCL.

Multi-device can also be done with multi-PAN commands, but I have only tested that with a ZNP radio and it's not really all that useful, since I don't believe the packets are relayed, nor are they encrypted.

MattWestb commented 1 year ago

@AskAlice You can (normally) only having one coordinator in one Zigbee network (or more true one trust center pair) that is controlling all devices. But if you can compiling own firmware you can doing one Zigbee Control Bridge that you having one serial port and CLI and can sending and receiving commands over the comport and controlling all devices in the network. Its the same way IKEA Tradfri is working and you can communicating with all devices in the network but not doing the trust center things. Search for it and you is finding one easy way doing it.

PS: I have cooking firmware for the old IKEA module with it and its working but i have not testing connecting it ESP32 but shall working OK.

Hedda commented 1 year ago

Doing a little digging I see zigpy is mostly used for coordinators, but could it be used in a device context? Communicating with the esp32 of a ttgo t-zigbee over serial, then relaying that over to another zigpy-controlled device (z2m or zha) ?

If there were a method of abstracting away the zigbee radio's firmware it could greatly improve the developer experience with working with these boards. For me, i'm kind of running into a brick wall at the moment because the sdk provided by telink only gives examples of firmware that works within the limits of the zigbee alliance's specification, which leaves me fairly in the dark about how to implement custom messaging that doesn't conform to ZCL or ZDO.

Tip on another possible alternative ESP32 target hardware for that described scenario could be the upcoming Espressif ESP32-C6 SoC series (and Espressif ESP32-H2 SoC series) which add an integrated 802.15.4 radio that supports Zigbee 3.0 (and Thread).

See related discussion here -> https://github.com/zigpy/zigpy/discussions/783

PS: I believe that those with Espressif contacts can get such DevKit boards for evaluation upon request(?) -> sales@espressif.com