zsmartsystems / com.zsmartsystems.zigbee

ZigBee Cluster Library Java framework supporting multiple dongles
Eclipse Public License 1.0
141 stars 87 forks source link

Zstack 3.x.0 support for TI CC2652 chip #1352

Open leonschenk opened 1 year ago

leonschenk commented 1 year ago

I have been developing this. I have tested with my Sonoff chip, I have no other devices to test. What needs to be done:

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

lgtm-com[bot] commented 1 year ago

This pull request introduces 8 alerts when merging 0c093aef622de92efed85fe96e5b3016635e1f7c into 1938be0e8cf3aaac3198202355a653528b4443f2 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 1 year ago

This pull request introduces 8 alerts when merging 8e040ae12947b5de244d9603ece780dea1e466e9 into 1938be0e8cf3aaac3198202355a653528b4443f2 - view on LGTM.com

new alerts:

lgtm-com[bot] commented 1 year ago

This pull request introduces 6 alerts when merging d22fb76748d3ca01ec1314c47b77c7cecd856ee3 into 1938be0e8cf3aaac3198202355a653528b4443f2 - view on LGTM.com

new alerts:

Hedda commented 1 year ago

What needs to be done:

  • bootloader/flashing capability

@leonschenk You might already be aware but FYI, many other projects depend on cc2538-bsl (Python cross-platform script) by JelmerT to upload firmware via the serial boot loader onto the CC13xx, CC2538 and CC26xx SoC. -> https://github.com/JelmerT/cc2538-bsl (and note it also have old versions but not the newer versions published via PyPI here -> https://pypi.org/project/cc2538/).

And FYI, another related tool is zigpy-cli -> https://github.com/zigpy/zigpy-cli as it can be used to backup the Zigbee network before flashing new firmware and then restoring such Zigbee network backups, and interestingly it saves the backups using the "Open ZigBee Coordinator Backup Format" -> https://github.com/zigpy/open-coordinator-backup which I understand is a unified format which supported under the hood by both Zigbee2MQTT and the ZHA integration in Home Assistant which technically could, in theory, make migration of a Zigbee network possible from one application to another (like from Zigbee2MQTT to OpenHAB ZigBee binding or vice versa).

cdjackson commented 1 year ago

@Hedda this project also supports firmware updates, and also supports coordinator backups. Ideally these features will be available for all coordinators within this project so that all systems using it have such support. This isn't really an issue for Home Assistant, or any other system (openHAB etc) - this is a low level library only!

cdjackson commented 1 year ago

@leonschenk please can you also address the issues raised by lgtm. Also, as per our other discussion, please just let me know when you think this is ready for review (ie you're happy that it has reasonable support for errors etc during initialisation).

leonschenk commented 1 year ago

@cdjackson It will take some time for me to work it out, I will take a look at lgtm. @Hedda do you have a device/setup with which you can test the produced library?

Hedda commented 1 year ago

@leonschenk which firmware build/version are you by the way using for testing? Guessing Z-Stack_3.x.0 20220219 from Koenkk?

https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin

https://github.com/Koenkk/Z-Stack-firmware/tree/develop/coordinator/Z-Stack_3.x.0/bin

@Hedda do you have a device/setup with which you can test the produced library?

Sorry I do not, suggest you perhaps ask for help with testing in openHAB Zigbee Binding request here:

https://github.com/openhab/org.openhab.binding.zigbee/issues/605

and/or maybe also in the openHAB community forum in these two threads:

https://community.openhab.org/t/discussion-about-texas-instruments-z-stack-3-0-and-cc2652-and-cc1352-zigbee-coordinator-adapters-with-openhab-zigbee-binding/129385

https://community.openhab.org/t/iteads-sonoff-zigbee-3-0-usb-dongle-plus-model-zbdongle-p-based-on-texas-instruments-cc2652p-20dbm-radio-mcu-now-sold-for-19-99/126738

leonschenk commented 1 year ago

@Hedda thank you for your suggestions. About bootloading capability: I will not be implementing this in the initial setup. If requested, I might implement this later. About "Open ZigBee Coordinator Backup Format": In this project the backup is independent with the 'dongle' firmware. I will upload a 'kar' file for testing in the openhab forum. I use version Z-Stack_3.x.0 20220219 from koenkk.

lgtm-com[bot] commented 1 year ago

This pull request introduces 1 alert when merging 0fc54f81b1b667d385fc15f76bf6c64b73399547 into 89b75409c9ee46e73c71d329959a9faf0d2513e7 - view on LGTM.com

new alerts:

leonschenk commented 1 year ago

@cdjackson I have some trouble with the discovery of my test device. The device is discovered, but it takes some time before the discovery is complete. This is due to the device which goes to sleep very soon. But is discovery always 'slow' (because I expected a discovery attempt directly after a 'DATA REQUEST', but this is not what I see). Is there any delay, or is it a bug in the Zstack implementation? If you would like to, I am able to send you a wireshark capture.

leonschenk commented 1 year ago

@cdjackson the dongle works very well. I have been testing it with 3 different devices for a week now. It has not crashed and works very stable. I have addressed all issues that I had previously. I hope you will merge my pull request and release a new version. I will be committed to the work of any bugs or improvements that pop up.

Hedda commented 1 year ago

FYI, Koenkk made a new Zigbee Coordinator firmware release:

https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin

https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_3.x.0/CHANGELOG.md

leonschenk commented 1 year ago

FYI, Koenkk made a new Zigbee Coordinator firmware release:

https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin

https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_3.x.0/CHANGELOG.md

Thank you @Hedda. I will take a look.

cdjackson commented 1 year ago

@leonschenk Please can you take a look at the comments I made on #1280 which I reviewed by mistake. These mostly relate to the changes to the ZigBeePort interface and implementations would unless there's a really good reason should not be changed. I think the only other comment I had was around the code generator - just to remove the @author tag and add the @Generated annotation.

I've not reviewed everything - I'm not sure if there's anything specifically you want me to look at (eg areas where you've made large changes from my original code)? I'm been through all the changed code (eg in common parts of the library and other than the serial interface changes I think it looks ok so would be happy to merge.

Hedda commented 1 year ago

@leonschenk Please can you take a look at the comments I made on #1280 which I reviewed by mistake. These mostly relate to the changes to the ZigBeePort interface and implementations would unless there's a really good reason should not be changed. I think the only other comment I had was around the code generator - just to remove the @author tag and add the @Generated annotation.

I've not reviewed everything - I'm not sure if there's anything specifically you want me to look at (eg areas where you've made large changes from my original code)? I'm been through all the changed code (eg in common parts of the library and other than the serial interface changes I think it looks ok so would be happy to merge.

@leonschenk and @t-8ch Do you have any updates on/for this PR for Z-Stack 3 driver?

Hedda commented 9 months ago

@leonschenk and @t-8ch Do you have any updates on/for this PR for Z-Stack 3 driver?

cdjackson posted in the forum that this needs to be updated or else it will probably not work:

https://community.openhab.org/t/discussion-about-texas-instruments-z-stack-3-0-and-cc2652-and-cc1352-zigbee-coordinator-adapters-with-openhab-zigbee-binding/129385/11

"Probably the version from November will not work any more - unless you use an old version of OH as well."