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

Introduce compatibility with recent zigpy changes and improve UART reset stability #51

Merged
merged 24 commits into from
Jun 26, 2024

Conversation

puddly
Copy link
Contributor

@puddly puddly commented May 10, 2024

This is a fairly large and disorganized PR to get the radio library working with zigpy-cli and ZHA. Main changes are:

  1. Remove probe, as zigpy now handles this by trying to connect.
  2. Remove all reconnection logic from the radio library. This is now handled by ZHA (or the upstream application).
  3. Load coordinator info, if possible, into node_info.model and node_info.manufacturer.
  4. Get api.reset() working properly by internally handling reconnection to the UART.
  5. Make sure network formation is completely stable:
    • reset, form, then backup should erase the old network completely and form a new one with random settings.
    • Running reset and form again will erase them, like before.
    • Running restore should bring back the old settings exactly: diff backup1.json backup2.json should differ only by the backup_time and NWK frame counter, everything else should be identical.
  6. Logging cleanup. I've moved listener-related messages to a separate logger, as otherwise the CLI was unreadably verbose.

A few things are left:

  1. Allow overriding the manufacturer code during joining so that new Aqara devices stay on the network: https://github.com/zigpy/bellows/blob/eae32eaf1158e0b9a6180e9b400f350ac96975a9/bellows/zigbee/application.py#L63-L66 (this should probably be moved to zigpy)
  2. Write unit tests so that any changes to zigpy can be tested against this library without having to run it.
  3. Replace zboss.types.basic, etc. with zigpy.types.basic: we want all radio libraries to use zigpy types wherever possible.
  4. Migrate to the zigpy pre-commit hooks so that auto code formatting works again.
  5. Run it for a few weeks on a production network to see if anything breaks 😄.

This radio library is looking really nice, the ZBOSS serial protocol and command set looks extensive and well-designed!

@puddly
Copy link
Contributor Author

puddly commented May 10, 2024

With these changes, I am able to get ZHA running with a nRF52840 stick and have migrated a functional test network to the ZBOSS radio. It continues to work fine and I can control devices. Commands, however, are inconsistent and sometimes have multi-second delays.

@puddly puddly changed the title API cleanup and fixes Introduce compatibility with recent zigpy changes and improve UART reset stability Jun 21, 2024
@puddly
Copy link
Contributor Author

puddly commented Jun 21, 2024

@DamKast Let me know if there's anything else I can do to get this PR merged.

@DamKast
Copy link
Collaborator

DamKast commented Jun 26, 2024

I am sorry it took so much time. Thanks a lot for the updates.

@DamKast DamKast merged commit 1d0179e into kardia-as:main Jun 26, 2024
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.

2 participants