Open Hedda opened 2 years ago
Thanks, that is an interesting project.
I was eventually planning on trying to add a similar shell using IPython for sending commands interactively (since it has autocompletion and is async-friendly).
Preliminary work has begun on merging bellows and zigpy-znp's respective command line tools into zigpy-cli:
I guess that "MFG_LAUNCH_BOOTLOADER" command to could maybe be ported first as command to enter Silabs bootloader?
Bootloader commands are low on the priority list, since that code is often pretty complex and uses internal radio library code. A plugin system could work, but since the existing bootloader tools are synchronous, it'd take either a complete rewrite to work with zigpy-cli, or the tools would essentially be run externally in a separate thread, which is no easier than directly running the original tools.
While the pyspinel is not made for Zigbee but for OpenThread NCPs instead, concepts in the Spinel CLI might however still be interesting as it is a relatively mature CLI for an NCP and actively maintained so might cover a lot of the same wishlist that developers and users would want?
A Python CLI tool called "Pyspinel" is available for testing purposes (and it is an active project so still being developed):
https://openthread.io/guides/pyspinel
_Pyspinel, available on the pyspinel GitHub repository, is a Python CLI for the Spinel protocol._
The Spinel CLI exposes the OpenThread configuration and management APIs running on an NCP build via a command line interface. Spinel CLI is primarily targeted for driving the automated continuous integration tests, and is suitable for manual experimentation with controlling OpenThread NCP instances.
Pyspinel is used to:
Use the CLI to play with NCP builds of OpenThread on a Linux or Mac OS platform, including starting a basic tunnel interface to allow IPv6 applications to run on the HOST and use the Thread network.
The power of this tool is threefold:
For more information, see the Internet-Draft for the Spinel Host-Controller Protocol:
https://datatracker.ietf.org/doc/html/draft-rquattle-spinel-unified
This full protocol source code is also included with OpenThread at
/src/lib/spinel
in openthread repo:https://github.com/openthread/openthread/tree/master/src/lib/spinel
For a production grade host driver that uses the Spinel CLI , see the "wpantund" project:
https://github.com/openthread/wpantund
One specific concept it had is "Vendor package" extension of the Spinel CLI with custom properties and commands:
https://github.com/openthread/pyspinel#vendor-package
"This plugin-like extension adds vendor-specific commands and properties to pyspinel in a way that does not impact the implementation of core pyspinel functionalities."
Just noticed this when Elelabs (maker of the Elelabs and Popp Zigbee sticks) forked it and made a vendor package for it:
https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs
With that they have started by including "btl", "data", and "help" as Elelabs Pyspinel vendor package commands:
https://github.com/Elelabs/pyspinel/blob/elelabs/elelabs/README.md
https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#btl
https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#data
https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#help
I guess that "MFG_LAUNCH_BOOTLOADER" command to could maybe be ported first as command to enter Silabs bootloader?
https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#elelabs-thread-spinel-commands
"Launch Bootloader NCP command. Causes the NCP to perform a software reset and enter XMODEM bootloader mode"