Giter Club home page Giter Club logo

zigpy-cli's Introduction

zigpy

Build Coverage Status

zigpy is a hardware independent Zigbee protocol stack integration project to implement Zigbee standard specifications as a Python 3 library.

Zigbee integration via zigpy allows you to connect one of many off-the-shelf Zigbee Coordinator adapters using one of the available Zigbee radio library modules compatible with zigpy to control Zigbee based devices. There is currently support for controlling Zigbee device types such as binary sensors (e.g., motion and door sensors), sensors (e.g., temperature sensors), lights, switches, buttons, covers, fans, climate control equipment, locks, and intruder alarm system devices. Note that Zigbee Green Power devices currently are unsupported.

Zigbee stacks and hardware from many different hardware chip manufacturers are supported via radio libraries which translate their proprietary communication protocol into a common API which is shared among all radio libraries for zigpy. If some Zigbee stack or Zigbee Coordinator hardware for other manufacturers is not supported by yet zigpy it is possible for any independent developer to step-up and develop a new radio library for zigpy which translates its proprietary communication protocol into the common API that zigpy can understand.

zigpy contains common code implementing ZCL (Zigbee Cluster Library) and ZDO (Zigbee Device Object) application state management which is being used by various radio libraries implementing the actual interface with the radio modules from different manufacturers. The separate radio libraries interface with radio hardware adapters/modules over USB and GPIO using different native UART serial protocols.

The ZHA integration component for Home Assistant, the Zigbee Plugin for Domoticz, and the Zigbee Plugin for Jeedom (competing open-source home automation software) are all using zigpy libraries as dependencies, as such they could be used as references of different implementations if looking to integrate a Zigbee solution into your application.

Zigbee device OTA updates

zigpy have ability to download and perform Zigbee OTAU (Over-The-Air Updates) of Zigbee devices firmware. The Zigbee OTA update firmware image files should conform to standard Zigbee OTA format and OTA provider source URLs need to be published for public availability. Updates from a local OTA update directory also is also supported and can be used as an option for offline firmware updates if user provide correct Zigbee OTA formatted firmware files themselves.

Support for automatic download from existing online OTA providers in zigpy OTA provider code is currently only available for IKEA, Inovelli, LEDVANCE/OSRAM, SALUS/Computime, and SONOFF/ITEAD devices. Support for additional OTA providers for other manufacturers devices could be added to zigpy in the future, if device manufacturers publish their firmware images publicly and developers contribute the needed download code for them.

How to install and test, report bugs, or contribute to this project

For specific instructions on how-to install and test zigpy or contribute bug-reports and code to this project please see the guidelines in the CONTRIBUTING.md file:

This CONTRIBUTING.md file will contain information about using zigpy, testing new releases, troubleshooting and bug-reporting as, as well as library + code instructions for developers and more. This file also contain short summaries and links to other related projects that directly or indirectly depends in zigpy libraries.

You can contribute to this project either as an end-user, a tester (advanced user contributing constructive issue/bug-reports) or as a developer contributing code.

Compatible Zigbee coordinator hardware

Radio libraries for zigpy are separate projects with their own repositories and include bellows (for communicating with Silicon Labs EmberZNet based radios), zigpy-deconz (for communicating with deCONZ based radios from Dresden Elektronik), and zigpy-xbee (for communicating with XBee based Zigbee radios), zigpy-zigate for communicating with ZiGate based radios, zigpy-znp or zigpy-cc for communicating with Texas Instruments based radios that have Z-Stack ZNP coordinator firmware.

Note! Zigbee 3.0 support or not in zigpy depends primarily on your Zigbee coordinator hardware and its firmware. Some Zigbee coordinator hardware support Zigbee 3.0 but might be shipped with an older firmware which does not, in which case may want to upgrade the firmware manually yourself. Some other Zigbee coordinator hardware may not support a firmware that is capable of Zigbee 3.0 at all but can still be fully functional and feature complete for your needs, (this is very common as many if not most Zigbee devices do not yet Zigbee 3.0 or are backwards-compable with a Zigbee profile that is support by your Zigbee coordinator hardware and its firmware). As a general rule, newer Zigbee coordinator hardware released can normally support Zigbee 3.0 firmware and it is up to its manufacturer to make such firmware available for them.

Compatible zigpy radio libraries

  • Digi XBee based Zigbee radios via the zigpy-xbee library for zigpy.
  • dresden elektronik deCONZ based Zigbee radios via the zigpy-deconz library for zigpy.
  • Silicon Labs (EmberZNet) based Zigbee radios using the EZSP protocol via the bellows library for zigpy.
  • Texas Instruments based Zigbee radios with all compatible Z-Stack firmware via the zigpy-znp library for zigpy.
  • ZiGate based ZigBee radios via the zigpy-zigate library for zigpy.

Legacy or obsolete zigpy radio libraries

  • Texas Instruments with Z-Stack legacy firmware via the zigpy-cc library for zigpy.

Release packages available via PyPI

New packages of tagged versions are also released via the "zigpy" project on PyPI

Older packages of tagged versions are still available on the "zigpy-homeassistant" project on PyPI

Packages of tagged versions of the radio libraries are released via separate projects on PyPI

zigpy-cli's People

Contributors

damkast avatar natexornate avatar puddly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zigpy-cli's Issues

Worth taking a look at pyspinel CLI as a reference?

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:

  • Add simulated Co-Processor testing to continuous integration.
  • Automate testing of testbeds running Co-Processor firmware on hardware.
  • Debug Co-Processor builds of OpenThread.
  • Convert an OpenThread Co-Processor into a packet sniffer.

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:

  1. As a path to add testing of the NCP in simulation to continuous integration
  2. As a path to automated testing of testbeds running NCP firmware on hardware
  3. As a simple debugging tool for NCP builds of OpenThread

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"

$ cd <path-to-pyspinel>
$ spinel-cli.py -u /dev/ttyS1 -b 115200 --vendor-path=elelabs
spinel-cli > version
SL-OPENTHREAD/1.1.2.0_GitHub-5c2ad91cf; EFR32; Jun 16 2021 22:54:45
Done
spinel-cli > vendor data
Elelabs
Done
ELU013
Done
spinel-cli > vendor btl
spinel-cli > exit

[BUG] Version inconsistency on installation from GitHub

Hi, doing that :

pip install git+https://github.com/zigpy/zigpy.git
pip install git+https://github.com/zigpy/zigpy-cli.git
pip install git+https://github.com/zigpy/zigpy-znp.git
pip install git+https://github.com/zigpy/bellows.git

Getting (with decoration for readability) :

Full installation log (quite long)

 - - - Installing "git+https://github.com/zigpy/zigpy.git" - - - - - - - - - - - - - - - - - - - - - - - -

Collecting git+https://github.com/zigpy/zigpy.git
  Running command git clone --filter=blob:none --quiet https://github.com/zigpy/zigpy.git 'C:\Users\Kochise\AppData\Local\Temp\pip-req-build-tojucrt_'
  Cloning https://github.com/zigpy/zigpy.git to c:\users\Kochise\appdata\local\temp\pip-req-build-tojucrt_
  Resolved https://github.com/zigpy/zigpy.git to commit 85d148f9dc3b5719cf6919ea850eb5f86b288c5e
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting attrs
  Downloading attrs-22.2.0-py3-none-any.whl (60 kB)
     -------------------------------------- 60.0/60.0 kB 245.2 kB/s eta 0:00:00
Collecting aiohttp
  Downloading aiohttp-3.8.4-cp310-cp310-win_amd64.whl (319 kB)
     -------------------------------------- 319.8/319.8 kB 1.5 MB/s eta 0:00:00
Collecting aiosqlite>=0.16.0
  Downloading aiosqlite-0.18.0-py3-none-any.whl (15 kB)
Collecting async_timeout
  Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting crccheck
  Downloading crccheck-1.3.0-py3-none-any.whl (21 kB)
Collecting cryptography
  Downloading cryptography-40.0.1-cp36-abi3-win_amd64.whl (2.6 MB)
     ---------------------------------------- 2.6/2.6 MB 2.6 MB/s eta 0:00:00
Collecting voluptuous
  Downloading voluptuous-0.13.1-py3-none-any.whl (29 kB)
Collecting pyserial-asyncio!=0.5
  Downloading pyserial_asyncio-0.6-py3-none-any.whl (7.6 kB)
Collecting pyserial
  Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
     ---------------------------------------- 90.6/90.6 kB 5.4 MB/s eta 0:00:00
Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.3.3-cp310-cp310-win_amd64.whl (33 kB)
Collecting yarl<2.0,>=1.0
  Downloading yarl-1.8.2-cp310-cp310-win_amd64.whl (56 kB)
     ---------------------------------------- 56.1/56.1 kB 1.5 MB/s eta 0:00:00
Collecting charset-normalizer<4.0,>=2.0
  Downloading charset_normalizer-3.1.0-cp310-cp310-win_amd64.whl (97 kB)
     ---------------------------------------- 97.1/97.1 kB 2.8 MB/s eta 0:00:00
Collecting multidict<7.0,>=4.5
  Downloading multidict-6.0.4-cp310-cp310-win_amd64.whl (28 kB)
Collecting aiosignal>=1.1.2
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting cffi>=1.12
  Downloading cffi-1.15.1-cp310-cp310-win_amd64.whl (179 kB)
     -------------------------------------- 179.1/179.1 kB 1.1 MB/s eta 0:00:00
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
     -------------------------------------- 118.7/118.7 kB 1.4 MB/s eta 0:00:00
Collecting idna>=2.0
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     -------------------------------------- 61.5/61.5 kB 814.3 kB/s eta 0:00:00
Building wheels for collected packages: zigpy
  Building wheel for zigpy (setup.py): started
  Building wheel for zigpy (setup.py): finished with status 'done'
  Created wheel for zigpy: filename=zigpy-0.54.0.dev0-py3-none-any.whl size=171689 sha256=dfb8a2ad0a09697ed9b8b94505eaa933a462135528c2d9d3744cce78edbe6a78
  Stored in directory: C:\Users\Kochise\AppData\Local\Temp\pip-ephem-wheel-cache-94e01dkg\wheels\1e\40\8f\81b14cd173c853dbab24dda1b3b810bdac8c4d047abf1d93e3
Successfully built zigpy
Installing collected packages: voluptuous, pyserial, crccheck, pyserial-asyncio, pycparser, multidict, idna, frozenlist, charset-normalizer, attrs, async_timeout, aiosqlite, yarl, cffi, aiosignal, cryptography, aiohttp, zigpy
Successfully installed aiohttp-3.8.4 aiosignal-1.3.1 aiosqlite-0.18.0 async_timeout-4.0.2 attrs-22.2.0 cffi-1.15.1 charset-normalizer-3.1.0 crccheck-1.3.0 cryptography-40.0.1 frozenlist-1.3.3 idna-3.4 multidict-6.0.4 pycparser-2.21 pyserial-3.5 pyserial-asyncio-0.6 voluptuous-0.13.1 yarl-1.8.2 zigpy-0.54.0.dev0

 - - - Installing "git+https://github.com/zigpy/zigpy-cli.git" - - - - - - - - - - - - - - - - - - - - - - - -

Collecting git+https://github.com/zigpy/zigpy-cli.git
  Running command git clone --filter=blob:none --quiet https://github.com/zigpy/zigpy-cli.git 'C:\Users\Kochise\AppData\Local\Temp\pip-req-build-vv1i5g4c'
  Cloning https://github.com/zigpy/zigpy-cli.git to c:\users\Kochise\appdata\local\temp\pip-req-build-vv1i5g4c
  Resolved https://github.com/zigpy/zigpy-cli.git to commit 125b537aa7ca0d76c8af3bf071803de7e3056a5c
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting zigpy-znp>=0.8.0
  Downloading zigpy_znp-0.10.0-py3-none-any.whl (122 kB)
     ------------------------------------ 122.3/122.3 kB 421.4 kB/s eta 0:00:00
Collecting coloredlogs
  Downloading coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB)
     ---------------------------------------- 46.0/46.0 kB 2.2 MB/s eta 0:00:00
Collecting click
  Downloading click-8.1.3-py3-none-any.whl (96 kB)
     ---------------------------------------- 96.6/96.6 kB 2.8 MB/s eta 0:00:00
Collecting bellows>=0.34.3
  Downloading bellows-0.35.0-py3-none-any.whl (218 kB)
     -------------------------------------- 218.2/218.2 kB 1.7 MB/s eta 0:00:00
Collecting scapy
  Downloading scapy-2.5.0.tar.gz (1.3 MB)
     ---------------------------------------- 1.3/1.3 MB 2.4 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting zigpy-deconz>=0.18.0
  Downloading zigpy_deconz-0.19.2-py3-none-any.whl (31 kB)
Collecting zigpy>=0.53.0
  Downloading zigpy-0.54.0-py3-none-any.whl (171 kB)
     -------------------------------------- 171.6/171.6 kB 2.6 MB/s eta 0:00:00
Collecting pure-pcapy3==1.0.1
  Downloading pure-pcapy3-1.0.1.tar.gz (5.9 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting click-log>=0.2.1
  Downloading click_log-0.4.0-py2.py3-none-any.whl (4.3 kB)
Collecting jsonschema
  Downloading jsonschema-4.17.3-py3-none-any.whl (90 kB)
     ---------------------------------------- 90.4/90.4 kB 1.7 MB/s eta 0:00:00
Collecting colorama
  Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting humanfriendly>=9.1
  Downloading humanfriendly-10.0-py2.py3-none-any.whl (86 kB)
     ---------------------------------------- 86.8/86.8 kB 1.2 MB/s eta 0:00:00
Collecting pyreadline3
  Downloading pyreadline3-3.4.1-py3-none-any.whl (95 kB)
     ---------------------------------------- 95.2/95.2 kB 1.1 MB/s eta 0:00:00
Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
  Downloading pyrsistent-0.19.3-cp310-cp310-win_amd64.whl (62 kB)
     -------------------------------------- 62.7/62.7 kB 846.4 kB/s eta 0:00:00
Building wheels for collected packages: zigpy-cli, pure-pcapy3, scapy
  Building wheel for zigpy-cli (pyproject.toml): started
  Building wheel for zigpy-cli (pyproject.toml): finished with status 'done'
  Created wheel for zigpy-cli: filename=zigpy_cli-0.0.0-py3-none-any.whl size=25453 sha256=079a6373dd5698ec07e461baac561221b61f11ab46238aca9a0e6cf64722f92e
  Stored in directory: C:\Users\Kochise\AppData\Local\Temp\pip-ephem-wheel-cache-zorva2sh\wheels\a0\0f\1e\7d823b6342d74dc11cc963ff1ea3d2a0ef1468c483d716a0d7
  Building wheel for pure-pcapy3 (setup.py): started
  Building wheel for pure-pcapy3 (setup.py): finished with status 'done'
  Created wheel for pure-pcapy3: filename=pure_pcapy3-1.0.1-py3-none-any.whl size=5034 sha256=d79fcb33819034041af5e54f7d0289fd7201f10158584c25d6e18fbf352099cb
  Stored in directory: C:\Users\Kochise\AppData\Local\Temp\pip-ephem-wheel-cache-zorva2sh\wheels\85\cd\07\df2f1523280f09843135c8ac9229b269883fc1df331b784eeb
  Building wheel for scapy (setup.py): started
  Building wheel for scapy (setup.py): finished with status 'done'
  Created wheel for scapy: filename=scapy-2.5.0-py2.py3-none-any.whl size=1444341 sha256=ff73714e03155601ef3bc0b913a4291505f9312e8edbc0c3a767a4d6bbf0a365
  Stored in directory: C:\Users\Kochise\AppData\Local\Temp\pip-ephem-wheel-cache-zorva2sh\wheels\82\b7\03\8344d8cf6695624746311bc0d389e9d05535ca83c35f90241d
Successfully built zigpy-cli pure-pcapy3 scapy
Installing collected packages: pyreadline3, scapy, pyrsistent, pure-pcapy3, humanfriendly, colorama, jsonschema, coloredlogs, click, zigpy, click-log, zigpy-znp, zigpy-deconz, bellows, zigpy-cli
  Attempting uninstall: zigpy
    Found existing installation: zigpy 0.54.0.dev0
    Uninstalling zigpy-0.54.0.dev0:
      Successfully uninstalled zigpy-0.54.0.dev0
Successfully installed bellows-0.35.0 click-8.1.3 click-log-0.4.0 colorama-0.4.6 coloredlogs-15.0.1 humanfriendly-10.0 jsonschema-4.17.3 pure-pcapy3-1.0.1 pyreadline3-3.4.1 pyrsistent-0.19.3 scapy-2.5.0 zigpy-0.54.0 zigpy-cli-0.0.0 zigpy-deconz-0.19.2 zigpy-znp-0.10.0

 - - - Installing "git+https://github.com/zigpy/zigpy-znp.git" - - - - - - - - - - - - - - - - - - - - - - - -

Collecting git+https://github.com/zigpy/zigpy-znp.git
  Running command git clone --filter=blob:none --quiet https://github.com/zigpy/zigpy-znp.git 'C:\Users\Kochise\AppData\Local\Temp\pip-req-build-4v8ntk6n'
  Cloning https://github.com/zigpy/zigpy-znp.git to c:\users\Kochise\appdata\local\temp\pip-req-build-4v8ntk6n
  Resolved https://github.com/zigpy/zigpy-znp.git to commit 3f6ba1b1b6aa57ab6b41413de5a9551fefd72e25
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: zigpy-znp
  Building wheel for zigpy-znp (pyproject.toml): started
  Building wheel for zigpy-znp (pyproject.toml): finished with status 'done'
  Created wheel for zigpy-znp: filename=zigpy_znp-0.0.0-py3-none-any.whl size=122347 sha256=04c26cdc37ef5e4236ef1501e655f528532db7f2c560b3077cf9df89c9912df4
  Stored in directory: C:\Users\Kochise\AppData\Local\Temp\pip-ephem-wheel-cache-amxhvrme\wheels\f7\e2\e9\a248a35764afca6a68e384613c3caeca3027651d29895eaf03
Successfully built zigpy-znp
Installing collected packages: zigpy-znp
  Attempting uninstall: zigpy-znp
    Found existing installation: zigpy-znp 0.10.0
    Uninstalling zigpy-znp-0.10.0:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
zigpy-cli 0.0.0 requires zigpy-znp>=0.8.0, but you have zigpy-znp 0.0.0 which is incompatible.
      Successfully uninstalled zigpy-znp-0.10.0
Successfully installed zigpy-znp-0.0.0

 - - - Installing "git+https://github.com/zigpy/bellows.git" - - - - - - - - - - - - - - - - - - - - - - - -

Collecting git+https://github.com/zigpy/bellows.git
  Running command git clone --filter=blob:none --quiet https://github.com/zigpy/bellows.git 'C:\Users\Kochise\AppData\Local\Temp\pip-req-build-uaorbawi'
  Cloning https://github.com/zigpy/bellows.git to c:\users\Kochise\appdata\local\temp\pip-req-build-uaorbawi
  Resolved https://github.com/zigpy/bellows.git to commit 8ad0c59d04f049a537232149da6af6fb20580ee4
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: bellows
  Building wheel for bellows (setup.py): started
  Building wheel for bellows (setup.py): finished with status 'done'
  Created wheel for bellows: filename=bellows-0.35.0.dev0-py3-none-any.whl size=218282 sha256=10c1ef5d2951ae4f7c1adb2fca3df188579fa8dcc8cb36561b758f547cb4d45b
  Stored in directory: C:\Users\Kochise\AppData\Local\Temp\pip-ephem-wheel-cache-k6m8low3\wheels\e1\73\27\a2a5475650b15cc9062237436a971e10ee76bad785106323ee
Successfully built bellows
Installing collected packages: bellows
  Attempting uninstall: bellows
    Found existing installation: bellows 0.35.0
    Uninstalling bellows-0.35.0:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
zigpy-cli 0.0.0 requires zigpy-znp>=0.8.0, but you have zigpy-znp 0.0.0 which is incompatible.
      Successfully uninstalled bellows-0.35.0
Successfully installed bellows-0.35.0.dev0


Why the following "errors" :

 - - - Installing "git+https://github.com/zigpy/zigpy.git" - - - - - - - - - - - - - - - - - - - - - - - -

  Created wheel for zigpy: filename=zigpy-0.54.0.dev0-py3-none-any.whl size=171689 sha256=dfb8a2ad0a09697ed9b8b94505eaa933a462135528c2d9d3744cce78edbe6a78

Ok so far...

 - - - Installing "git+https://github.com/zigpy/zigpy-cli.git" - - - - - - - - - - - - - - - - - - - - - - - -

Collecting zigpy>=0.53.0
  Downloading zigpy-0.54.0-py3-none-any.whl (171 kB)
     -------------------------------------- 171.6/171.6 kB 2.6 MB/s eta 0:00:00

  Created wheel for zigpy-cli: filename=zigpy_cli-0.0.0-py3-none-any.whl size=25453 sha256=079a6373dd5698ec07e461baac561221b61f11ab46238aca9a0e6cf64722f92e

Installing collected packages: zigpy
  Attempting uninstall: zigpy
    Found existing installation: zigpy 0.54.0.dev0
    Uninstalling zigpy-0.54.0.dev0:
      Successfully uninstalled zigpy-0.54.0.dev0
Successfully installed zigpy-0.54.0

Why 0.0.0 for zigpy-cli ? Why not at least 0.0.0.dev0 ?

Why replacing zigpy-0.54.0.dev0 with zigpy-0.54.0 ?

 - - - Installing "git+https://github.com/zigpy/zigpy-znp.git" - - - - - - - - - - - - - - - - - - - - - - - -

  Created wheel for zigpy-znp: filename=zigpy_znp-0.0.0-py3-none-any.whl size=122347 sha256=04c26cdc37ef5e4236ef1501e655f528532db7f2c560b3077cf9df89c9912df4

Successfully built zigpy-znp
Installing collected packages: zigpy-znp
  Attempting uninstall: zigpy-znp
    Found existing installation: zigpy-znp 0.10.0
    Uninstalling zigpy-znp-0.10.0:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
zigpy-cli 0.0.0 requires zigpy-znp>=0.8.0, but you have zigpy-znp 0.0.0 which is incompatible.
      Successfully uninstalled zigpy-znp-0.10.0
Successfully installed zigpy-znp-0.0.0

Why 0.0.0 for zigpy-znp ? Why not at least 0.0.0.dev0 ?

Why uninstalling zigpy-znp-0.10.0 then immediately installing zigpy-znp-0.0.0 instead ?

Why this :

zigpy-cli 0.0.0 requires zigpy-znp>=0.8.0, but you have zigpy-znp 0.0.0 which is incompatible.

Let's continue...

 - - - Installing "git+https://github.com/zigpy/bellows.git" - - - - - - - - - - - - - - - - - - - - - - - -

  Created wheel for bellows: filename=bellows-0.35.0.dev0-py3-none-any.whl size=218282 sha256=10c1ef5d2951ae4f7c1adb2fca3df188579fa8dcc8cb36561b758f547cb4d45b

Successfully built bellows
Installing collected packages: bellows
  Attempting uninstall: bellows
    Found existing installation: bellows 0.35.0
    Uninstalling bellows-0.35.0:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
zigpy-cli 0.0.0 requires zigpy-znp>=0.8.0, but you have zigpy-znp 0.0.0 which is incompatible.
      Successfully uninstalled bellows-0.35.0
Successfully installed bellows-0.35.0.dev0

Why this again :

zigpy-cli 0.0.0 requires zigpy-znp>=0.8.0, but you have zigpy-znp 0.0.0 which is incompatible.

Doing a pip freeze gives :

bellows @ git+https://github.com/zigpy/bellows.git@8ad0c59d04f049a537232149da6af6fb20580ee4
zigpy==0.54.0
zigpy-cli @ git+https://github.com/zigpy/zigpy-cli.git@125b537aa7ca0d76c8af3bf071803de7e3056a5c
zigpy-deconz==0.19.2
zigpy-znp @ git+https://github.com/zigpy/zigpy-znp.git@3f6ba1b1b6aa57ab6b41413de5a9551fefd72e25

Any reason for the 0.0.0 version for zigpy-cli and zigpy-znp ?

Where if the 0.54.0.dev0 for zigpy ?

Where if the 0.35.0.dev0 for bellows ?

Pretty strange...

Regards.

Maybe also worth taking a look at the Zigbee Shell / CLI wrapper for Nordic Semi nRF5 family of NCP as a reference?

Nordic Semi who makes nRF5 series of multi-protocol chips have a Zigbee Shell / CLI wrapper might be worth a look for reference?

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/zigbee/shell/README.html

Their arguments for going with the CLI Zigbee architecture they did in this command shell is shortly described here:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.1.0%2Fzigbee_architectures.html&cp=8_7_0_3_2

Nordic Semiconductor has this quick reference with commands supported by their Zigbee CLI:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.1.0%2Fzigbee_example_cli_reference.html

And examples for Zigbee NCP:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.1.0%2Fzigbee_only_examples.html

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.1.0%2Fzigbee_example_cli_agent.html

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.1.0%2Fzigbee_example_cli_agent.html&cp=8_3_3_8_5_1_0&anchor=zigbee_example_cli_agent_interfaces

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.1.0%2Fzigbee_example_ota_examples.html

It also includes a sample implementation of how their Zigbee CLI can be used for the implementation of a Zigbee-MQTT gateway:

https://infocenter.nordicsemi.com/topic/sdk_tz_v4.1.0/zigbee_cli_wrapper.html#zigbee_cli_wrapper_mqtt

There is also this real-world example of a project implementing a slightly older version of that Nordic Semi's Zigbee CLI wrapper:

https://github.com/hipiphock/Dongle-Handler/ (and related https://github.com/ninima0323/TestGUI which uses that handler).

FYI; nRF52 series and nRF53 Evaluation Kir and Development Kit hardware for nRF Connect SDK is relatively inexpensive to buy:

https://www.nordicsemi.com/Products/nRF52840

https://www.nordicsemi.com/Products/nRF5340

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf52.html#ug-nrf52

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf53.html#ug-nrf53

Note that their NCP solution for nRF52/nRF53 (nRF52840/nRF52833/nRF5340) has now reached a v1.0.0 milestone in NCS v1.7.0:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/releases/release-notes-1.7.0.html#zigbee

PS: Most of the links comes from zigpy/zigpy#394 which is a request for nRF5 Zigbee radio library for Nordic Semi nRF52 / nRF53.

Silicon Labs Zigbee EmberZNet 7.0.0.0 migrated to the new unified CLI system for Ember

Silabs released Zigbee EmberZNet 7.0.0.0 which among other new things apper to migrate to a new unified CLI system for Ember:

https://www.silabs.com/documents/public/release-notes/emberznet-release-notes-7.0.0.0.pdf

https://docs.silabs.com/gecko-platform/4.0/service/cli/overview

http://docs.silabs.com/zigbee/7.0

They also for the first time release the Zigbee SDK publicly on GitHub

https://github.com/SiliconLabs/gecko_sdk/releases

https://github.com/SiliconLabs/gecko_sdk

https://github.com/SiliconLabs/gecko_sdk/tree/gsdk_4.0/protocol/zigbee

https://docs.silabs.com/gecko-platform/4.0/

1.1 New APIs

New in release 7.0.0.0

For an extensive list of new APIs in this release, refer to Zigbee Stack API documentation and Zigbee Application Framework API documentation on https://docs.silabs.com/ .

Command Line Interface (CLI)

Zigbee migrated to the new/unified CLI system. All emberXXXArgument() APIs are changed to sl_cli_XXX_argument_XXX()
APIs (e.g., emberCommandArgumentCount() → sl_cli_get_argument_count()). Refer to the sl_cli.h header file and its documentation
for available CLI command APIs.

In the newly integrated CLI, hexadecimal string and ASCII string arguments have dedicated types. These arguments can be retrieved
using the related APIs sl_cli_get_command_string() and sl_cli_get_argument_hex(). See sl_cli.h for more information.

1.3 New Documentation

New in release 7.0.0.0

All components have documentation available. If you have an issue seeing the documentation when you select the component in Project Configurator, you can find it here: http://docs.silabs.com/zigbee/7.0

New software documentation available through Simplicity Studio’s Documentation page includes:

• AN1301: Transitioning from Zigbee EmberZNet SDK 6.x to SDK 7.x
• AN1322: Dynamic Multiprotocol Development with Bluetooth and and Zigbee EmberZNet SDK 7.0 and Higher
• AN1325: Zigbee Cluster Configurator User's Guide
• AN1333: Running Zigbee, OpenThread, and Bluetooth Concurrently on a Linux Host with a Multiprotocol RCP
• QSG180: Zigbee EmberZNet Quick-Start Guide for SDK 7.0 and Higher
• UG491: Zigbee Application Framework Developer’s Guide for SDK 7.0 and Higher

PS: Not sure if Gecko SDK 4.0 was accidentally released or official as of yet as their version history still says that Gecko SDK Suite 3.2 is latest:

https://docs.silabs.com/gecko-platform/latest/version-history

Link to 4.0 seem to work through:

https://docs.silabs.com/gecko-platform/4.0/

OTA command failing with HueSBLOTAImage

Running the following command produces an error, as zigpy's HueSBLOTAImage does not have (valid) subelements:
zigpy-cli ota info LivingColors-Atmel-Target_0012.sbl-ota

Download link for the OTA image: https://otau.meethue.com/storage/ZGB_100B_0108/55fb9cf3-afb6-4ef5-8887-905699da7ee8/LivingColors-Atmel-Target_0012.sbl-ota

The error is caused here when printing the number of subelements:

print(f"Number of subelements: {len(image.subelements)}")

Command output:

Header: OTAImageHeader(upgrade_file_id=200208670, header_version=256, header_length=56, field_control=<FieldControl.0: 0>, manufacturer_id=4107, image_type=264, file_version=1124099330, stack_version=2, header_string='', image_size=256696, *device_specific_file=False, *hardware_versions_present=False, *key=ImageKey(manufacturer_id=4107, image_type=264), *security_credential_version_present=False)
Traceback (most recent call last):
  File "/Users/test/GP/zigpy-cli/venv/bin/zigpy", line 33, in <module>
    sys.exit(load_entry_point('zigpy-cli==0.0.1', 'console_scripts', 'zigpy')())
  File "/Users/test/GP/zigpy-cli/venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/test/GP/zigpy-cli/venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/test/GP/zigpy-cli/venv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/test/GP/zigpy-cli/venv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/test/GP/zigpy-cli/venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/test/GP/zigpy-cli/venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/test/GP/zigpy-cli/venv/lib/python3.10/site-packages/zigpy_cli/ota.py", line 37, in info
    print(f"Number of subelements: {len(image.subelements)}")
AttributeError: 'HueSBLOTAImage' object has no attribute 'subelements'

Migration bugged - Restore does not seem to work

Hello,

is anyone still looking into this?
I posted as a reply in another issue, but wanted to try this here one more time.

I tried following the instructions and I hit a wall and I am not sure how to proceed. Maybe someone here can help me out.

The backup seems to work. I get one or two warnings about unknown devices but that's it.
I followed the post above with the suggested settings.
The problem starts when I try to restore my file to the conbee 3.

I change my settings, including the baudarate, and start the zigpy-cli addon.
There seem to be a lot of errors coming up, as I can only copy-paste parts of it since the rest is not visible anymore:

Does anyone know what the problem could be?
I rebooted my computer when changing the USB stick to make sure it is recognized properly.

return await zigpy.zdo.broadcast(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 623, in broadcast
    return await app.broadcast(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 921, in broadcast
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 522, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')
2024-02-12 18:30:23.792 d0f5a498-tzb-zigpy-cli-tools asyncio ERROR Task exception was never retrieved
future: <Task finished name='discover_unknown_device_from_packet-nwk=0xDD6E' coro=<ControllerApplication._discover_unknown_device() done, defined at /usr/local/lib/python3.11/site-packages/zigpy/application.py:942> exception=DeliveryError("Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 508, in send_packet
    await self._api.aps_data_request(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 871, in aps_data_request
    rsp = await self.send_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 508, in send_command
    return await self._command(cmd, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 586, in _command
    return await fut
           ^^^^^^^^^
zigpy_deconz.exception.CommandError: <CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 945, in _discover_unknown_device
    return await zigpy.zdo.broadcast(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 623, in broadcast
    return await app.broadcast(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 921, in broadcast
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 522, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')
2024-02-12 18:30:23.808 d0f5a498-tzb-zigpy-cli-tools asyncio ERROR Task exception was never retrieved
future: <Task finished name='discover_unknown_device_from_packet-nwk=0xDD6E' coro=<ControllerApplication._discover_unknown_device() done, defined at /usr/local/lib/python3.11/site-packages/zigpy/application.py:942> exception=DeliveryError("Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 508, in send_packet
    await self._api.aps_data_request(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 871, in aps_data_request
    rsp = await self.send_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 508, in send_command
    return await self._command(cmd, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 586, in _command
    return await fut
           ^^^^^^^^^
zigpy_deconz.exception.CommandError: <CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 945, in _discover_unknown_device
    return await zigpy.zdo.broadcast(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 623, in broadcast
    return await app.broadcast(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 921, in broadcast
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 522, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')
2024-02-12 18:30:23.825 d0f5a498-tzb-zigpy-cli-tools asyncio ERROR Task exception was never retrieved
future: <Task finished name='discover_unknown_device_from_packet-nwk=0xDD6E' coro=<ControllerApplication._discover_unknown_device() done, defined at /usr/local/lib/python3.11/site-packages/zigpy/application.py:942> exception=DeliveryError("Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 508, in send_packet
    await self._api.aps_data_request(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 871, in aps_data_request
    rsp = await self.send_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 508, in send_command
    return await self._command(cmd, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 586, in _command
    return await fut
           ^^^^^^^^^
zigpy_deconz.exception.CommandError: <CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 945, in _discover_unknown_device
    return await zigpy.zdo.broadcast(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 623, in broadcast
    return await app.broadcast(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 921, in broadcast
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 522, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')
2024-02-12 18:30:23.808 d0f5a498-tzb-zigpy-cli-tools asyncio ERROR Task exception was never retrieved
future: <Task finished name='discover_unknown_device_from_packet-nwk=0xDD6E' coro=<ControllerApplication._discover_unknown_device() done, defined at /usr/local/lib/python3.11/site-packages/zigpy/application.py:942> exception=DeliveryError("Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 508, in send_packet
    await self._api.aps_data_request(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 871, in aps_data_request
    rsp = await self.send_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 508, in send_command
    return await self._command(cmd, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 586, in _command
    return await fut
           ^^^^^^^^^
zigpy_deconz.exception.CommandError: <CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 945, in _discover_unknown_device
    return await zigpy.zdo.broadcast(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 623, in broadcast
    return await app.broadcast(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 921, in broadcast
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 522, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')
2024-02-12 18:30:23.825 d0f5a498-tzb-zigpy-cli-tools asyncio ERROR Task exception was never retrieved
future: <Task finished name='discover_unknown_device_from_packet-nwk=0xDD6E' coro=<ControllerApplication._discover_unknown_device() done, defined at /usr/local/lib/python3.11/site-packages/zigpy/application.py:942> exception=DeliveryError("Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 508, in send_packet
    await self._api.aps_data_request(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 871, in aps_data_request
    rsp = await self.send_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 508, in send_command
    return await self._command(cmd, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 586, in _command
    return await fut
           ^^^^^^^^^
zigpy_deconz.exception.CommandError: <CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 945, in _discover_unknown_device
    return await zigpy.zdo.broadcast(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 623, in broadcast
    return await app.broadcast(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 921, in broadcast
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 522, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to enqueue packet: CommandError('<CommandId.aps_data_request: 18>, status: <Status.NO_NETWORK: 6>')
2024-02-12 18:30:26.881 d0f5a498-tzb-zigpy-cli-tools zigpy.application WARNING Unknown device AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x2BB3)
2024-02-12 18:30:26.913 d0f5a498-tzb-zigpy-cli-tools zigpy.application WARNING Unknown device AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0xDB98)
[18:30:27] INFO: Action Complete
[18:30:27] INFO: zigpy-cli-up script exited with code 0
s6-rc: info: service zigpy-cli successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service zigpy-cli: stopping
s6-rc: info: service zigpy-cli successfully stopped
s6-rc: info: service banner: stopping
s6-rc: info: service banner successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Unable to backup HUSBZB-1

I am struggling to back up my HUSBZB-1 - with the goal of migrating to a Sonoff Zigbee USB dongle.

environment info:

(venv)  zigpy $ python --version
Python 3.8.12
(venv)  zigpy $ udevadm info -a -n /dev/ttyUSB1 | grep '{interface}' | head -n1
    ATTRS{interface}=="HubZ ZigBee Com Port"

I was trying to follow along with this ticket, so I used the braches there: #2

pip install \
    git+https://github.com/puddly/zigpy.git@puddly/new-radio-settings-api \
    git+https://github.com/puddly/zigpy-cli.git@puddly/zigpy-radio-api \
    git+https://github.com/puddly/zigpy-znp.git@puddly/new-radio-settings-api \
    git+https://github.com/puddly/zigpy-deconz.git@puddly/new-radio-api \
    git+https://github.com/puddly/bellows.git@puddly/zigpy-radio-api

This is what I see when I try to run a backup. After the last line it just hangs for minutes until I send ^c.

(venv)  zigpy $ zigpy -vv radio ezsp /dev/ttyUSB1 backup backup.json
2022-03-12 15:53:58.133 localhost.localdomain asyncio DEBUG Using selector: EpollSelector
2022-03-12 15:53:58.238 localhost.localdomain zigpy.appdb DEBUG SQLite version for <module 'sqlite3' from '/usr/lib64/python3.8/sqlite3/__init__.py'>: 3.37.2
2022-03-12 15:53:58.292 localhost.localdomain asyncio DEBUG Using selector: EpollSelector
2022-03-12 15:53:58.412 localhost.localdomain bellows.ezsp DEBUG Resetting EZSP
2022-03-12 15:53:58.413 localhost.localdomain bellows.uart DEBUG Resetting ASH
2022-03-12 15:53:58.413 localhost.localdomain bellows.uart DEBUG Sending: b'1ac038bc7e'
2022-03-12 15:53:59.712 localhost.localdomain bellows.uart DEBUG RSTACK Version: 2 Reason: RESET_POWER_ON frame: b'c102029b7b7e'
2022-03-12 15:53:59.712 localhost.localdomain bellows.ezsp ERROR NCP entered failed state. Requesting APP controller restart
2022-03-12 15:53:59.713 localhost.localdomain bellows.uart DEBUG Closed serial connection

^c results in this log:

2022-03-12 15:59:45.700 localhost.localdomain asyncio ERROR Task was destroyed but it is pending!
task: <Task pending name='Task-6' coro=<Gateway.reset() running at ~/dev/zigpy/venv/lib/python3.8/site-packages/bellows/uart.py:223> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f31031cdaf0>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/lib64/python3.8/asyncio/futures.py:367]>

and have also tried the master branch:

(venv)  zigpy $ pip install  --force-reinstall   git+https://github.com/puddly/zigpy.git     git+https://github.com/puddly/zigpy-cli.git    git+https://github.com/puddly/zigpy-znp.git    git+https://github.com/puddly/zigpy-deconz.git     git+https://github.com/puddly/bellows.git

which gave me a syntax error (it looks like backup isn't a command there yet?)

I don't remember what firmware version I have on my HUSBZB-1, but I did update it within the last year to the latest.

Any help is appreciated. Let me know if there is more info I can provide.

[BUG] Sonoff Zigbee 3.0 USB Dongle Plus-P (Windows)

Hi,

Source : https://sonoff.tech/product/gateway-and-sensors/sonoff-zigbee-3-0-usb-dongle-plus-p/

Installed (to get COM port) : https://sonoff.tech/wp-content/uploads/2022/08/CP210x_Windows_Drivers_with_Serial_Enumeration.zip

Fresh Python install :

pip install zigpy
pip install zigpy-cli
pip install zigpy-xbee
pip install zigpy-znp
pip install bellows
pip install zha-quirks

Then :

zigpy radio znp com10 reset
zigpy radio znp com10 form
zigpy radio znp com10 info

Getting :

Traceback (most recent call last):
  File "D:\TEST\Python\lib\site-packages\zigpy_znp\api.py", line 228, in load_network_info
    await self._load_network_info(load_devices=load_devices)
  File "D:\TEST\Python\lib\site-packages\zigpy_znp\api.py", line 104, in _load_network_info
    nib = await self.nvram.osal_read(OsalNvIds.NIB, item_type=t.NIB)
  File "D:\TEST\Python\lib\site-packages\zigpy_znp\nvram.py", line 171, in osal_read
    raise KeyError(f"NV item does not exist: {nv_id!r}")
KeyError: 'NV item does not exist: <OsalNvIds.NIB: 33>'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\TEST\Python\Lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\TEST\Python\Lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\TEST\Python\Scripts\zigpy.exe\__main__.py", line 7, in <module>
  File "D:\TEST\Python\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "D:\TEST\Python\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "D:\TEST\Python\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\TEST\Python\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\TEST\Python\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\TEST\Python\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "D:\TEST\Python\lib\site-packages\click\decorators.py", line 38, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "D:\TEST\Python\lib\site-packages\zigpy_cli\cli.py", line 20, in inner
    return loop.run_until_complete(cmd(*args, **kwargs))
  File "D:\TEST\Python\Lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "D:\TEST\Python\lib\site-packages\zigpy_cli\radio.py", line 86, in info
    await app.load_network_info(load_devices=False)
  File "D:\TEST\Python\lib\site-packages\zigpy_znp\zigbee\application.py", line 160, in load_network_info
    await self._znp.load_network_info(load_devices=load_devices)
  File "D:\TEST\Python\lib\site-packages\zigpy_znp\api.py", line 230, in load_network_info
    raise NetworkNotFormed() from e
zigpy.exceptions.NetworkNotFormed

Any idea how to make it work "out of the box" ?

Regards.

[BUG] no attribute 'attribute_updated' on 'permit'

Hi,

Fresh Python install :

pip install zigpy
pip install zigpy-cli
pip install zigpy-xbee
pip install zigpy-znp
pip install bellows
pip install zha-quirks

Then :

zigpy radio znp com10 reset
zigpy radio znp com10 form
zigpy radio znp com10 info

Getting :

PAN ID:                0x7486
Extended PAN ID:       d1:39:b5:2c:db:0b:04:25
Channel:               20
Channel mask:          [20]
NWK update ID:         0
Device IEEE:           00:12:4b:00:2a:2e:c1:cd
Device NWK:            0x0000
Network key:           13:76:a0:98:2a:6a:d1:3c:52:38:f7:0f:2d:7c:7a:61
Network key sequence:  0
Network key counter:   0

Now when I pair various devices (RGB bulb, contactless switch, temperature sensor), I get :

D:\TEST>zigpy radio znp com10 permit
2023-04-07 10:10:59.562 TEST zigpy.util WARNING Error calling listener <bound method ClusterPersistingListener.attribute_updated of <zigpy.zcl.ClusterPersistingListener object at 0x0000028E6D3B10F0>> with args (4, 'HEIMAN'): AttributeError("'NoneType' object has no attribute 'attribute_updated'")
2023-04-07 10:10:59.562 TEST zigpy.util WARNING Error calling listener <bound method ClusterPersistingListener.attribute_updated of <zigpy.zcl.ClusterPersistingListener object at 0x0000028E6D3B10F0>> with args (5, 'ColorLight'): AttributeError("'NoneType' object has no attribute 'attribute_updated'")

D:\TEST>zigpy radio znp com10 permit
2023-04-07 11:54:16.742 TEST zigpy.util WARNING Error calling listener <bound method ClusterPersistingListener.attribute_updated of <zigpy.zcl.ClusterPersistingListener object at 0x000002356E4219F0>> with args (4, 'eWeLink'): AttributeError("'NoneType' object has no attribute 'attribute_updated'")
2023-04-07 11:54:16.742 TEST zigpy.util WARNING Error calling listener <bound method ClusterPersistingListener.attribute_updated of <zigpy.zcl.ClusterPersistingListener object at 0x000002356E4219F0>> with args (5, 'WB01'): AttributeError("'NoneType' object has no attribute 'attribute_updated'")

Additional '-vv' log is zigpy_cli_permit_attribute_updated_bug.txt

Regards.

[REQUEST] Publish zigpy-cli on PyPi?

@puddly Please consider publishing "zigpy-cli" on PyPI (similar to how zigpy is) so that it can more easily be used stand-alone:

https://pypi.org/project/zigpy

verses

https://pypi.org/project/zigpy-cli

Would be great if users want to use stand-alone zigpy-cli for backup and restore outside of Home Assistant's ZHA integration.

See these two use cases where the users are using Home Assistant SkyConnect USB adapter with Zigbee2MQTT instead of ZHA:

#24

Koenkk/zigbee2mqtt#16478

When I choose zigate to form a network , there is always zigpy.exceptions.NetworkNotFormed appear

Hey all,
The dongle I used is NXP 5169 and the firmware The software is downloaded from https://github.com/openlumi/ZiGate/release.
If I use this dongle with python third-party library zigate, it can form network and pair zigbee devices normally, and I can control device ON of OFF too。
However, I use the command "zigpy -vvvv radio zigate COM4 form",it always fail, and wrong message is "zigpy.exceptions.NetworkNotFormed".
image
I don't know what causes this problem. And when the program starts running, there also appear a warning message "Setting the pan_id is not supported by ZiGate". Em~~~~

Then I use command "zigpy radio zigate COM4 energy-scan", The program reported an error "asyncio.exceptions.TimeoutError" after running for some time. This is what has been bothering me for a long time.
image

Can anyone help me to deal these questions? Thank you, very much.

[REQUEST] Add command to probe running firmware?

Suggest add unified command in zigpy-cli to probe running firmware in order to dump EmberZNet Ember config from bellows via EZSP.

$ bellows -d /dev/ttyUSB1 -b 115200 config --all

and

$ bellows -d /dev/ttyUSB1 -b 115200 info

Then such zigpy CLI command could possibly later be extended to offer similar information probe in other radio libraries for zigpy too?

PS: @darkxst pull request for universal-silabs-flasher added wrappr for it here -> NabuCasa/universal-silabs-flasher#37

PPS: Also related to same feature request by xconverge here -> NabuCasa/universal-silabs-flasher#16

zigpy-cli - socket interface

Just a suggestion - add a daemon mode with a socket interface.

The socket interface would accept the same commands as the CLI but without addint the call to zigpy or the radio setting.

So the daemon could be started like this:

zigpy radio znp /dev/ttyUSB0 daemon --host 127.0.0.4 --port 3400

And then connections can be made to port 3400 to send commands, using telnet, netcat or whatever.

Example:

telnet 127.0.0.4 3400

Then inside the telnet session:

network info

The parsing of the commands would remain the same as on the cli, but then the tool would have a broader range of uses and the zigpy session can keep on running without requiring reinitialisation, potentially reporting incoming messages as well.

Add parameter to set channel

In order to force the channel, I updated the 'form' function like this:

async def form(app):
    app.config[conf.CONF_NWK][conf.CONF_NWK_CHANNEL]=11
    app.config[conf.CONF_NWK][conf.CONF_NWK_CHANNELS]=[11]
    await app.startup(auto_form=True)
    await app.form_network()
    dump_app_info(app)

I suggest to add a command line option allowing to force the channel or channel list.

Error using zigpy-cli

I have a jn5169 usb dongle for which I flashed zigate firmware.

Trying to use zigpy-cli, I got the following error, how should I use it properly?

PS D:\Workspace\zigpy-cli> zigpy radio zigate COM12 info
Traceback (most recent call last):
  File "C:\Users\lyy\AppData\Local\Programs\Python\Python310\Scripts\zigpy-script.py", line 33, in <module>
    sys.exit(load_entry_point('zigpy-cli==0.0.1', 'console_scripts', 'zigpy')())
  File "C:\Users\lyy\AppData\Local\Programs\Python\Python310\Scripts\zigpy-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "C:\Users\lyy\AppData\Local\Programs\Python\Python310\lib\importlib\metadata\__init__.py", line 162, in load
    module = import_module(match.group('module'))
  File "C:\Users\lyy\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\lyy\AppData\Local\Programs\Python\Python310\lib\site-packages\zigpy_cli\__main__.py", line 1, in <module>
    import zigpy_cli.ota  # noqa: F401
  File "C:\Users\lyy\AppData\Local\Programs\Python\Python310\lib\site-packages\zigpy_cli\ota.py", line 7, in <module>
    from zigpy.ota.image import ElementTagId, parse_ota_image
ImportError: cannot import name 'parse_ota_image' from 'zigpy.ota.image' (C:\Users\lyy\AppData\Local\Programs\Python\Python310\lib\site-packages\zigpy\ota\image.py)

Add Child, Remove Child, Remove Neighbor via direct manipulation of child/neighbor table by the application?

Feature for direct manipulation of child/neighbour table by the application to "Add Child", "Remove Child", "Remove Neighbor" might be nice to have for a few reasons but I think that it would be especially nice to be able to configure some devices to not use some device as a router(?).

I think what I would like to achieve is the option to manually blacklist specific devices so they are not used as Zigbee routers.

FYI, new API feature added Silabs Zigbee EmberZNet 6.10.0.0 which might be nice to consider for zigpy-cli for ZHA integration?

https://www.silabs.com/documents/public/release-notes/emberznet-release-notes-6.10.3.0.pdf

Added in release 6.10.0.0

emberAddChild() - SoC-only API for adding a child to the child/neighbor table, allowing direct manipulation of these tables by the application.

emberRemoveChild() - SoC-only API for removing a node from child/neighbor table, allowing direct manipulation of these tables by the application.

emberRemoveNeighbor() - SoC-only API for removing a node from neighbor table, allowing direct manipulation of these tables by the application.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.