zigpy-znp is a Python library that adds support for common Texas Instruments ZNP (Zigbee Network Processors) Zigbee radio modules to zigpy, a Python Zigbee stack project.
Together with zigpy and compatible home automation software (namely Home Assistant's ZHA (Zigbee Home Automation) integration component), you can directly control most Zigbee devices such as Philips Hue, GE, OSRAM LIGHTIFY, Xiaomi/Aqara, IKEA Tradfri, Samsung SmartThings, and many more.
Install the Python module from the PyPI within your virtual environment:
(venv) $ pip install zigpy-znp
Or the most recent commit directly from Git:
(venv) $ pip install git+https://github.com/zha-ng/zigpy-znp/
If you are using Home Assistant, copy custom_components/zha_custom_radios.py
into your custom_components
folder and create a new entry in your configuration.yaml
file:
zha_custom_radios:
znp:
module: zigpy_znp.zigbee.application
description: TI CC13x2, CC26x2, ZZH, and CC2531
Below are the defaults with the top-level Home Assistant zha:
key:
zha:
zigpy_config:
znp_config:
tx_power: # if set, must be between -22 (low) and 19 (high)
led_mode: # if set, must be one of: off, on, blink, flash, toggle
skip_bootloader: True # skips the 60s bootloader delay on some CC2531 sticks
A complete NVRAM backup can be performed to migrate between different radios based on the same chip. Anything else is untested.
(venv) $ python -m zigpy_znp.tools.nvram_read /dev/serial/by-id/old_radio -o backup.json
(venv) $ python -m zigpy_znp.tools.nvram_write /dev/serial/by-id/new_radio -i backup.json
Tested migrations:
- LAUNCHXL-CC26X2R1 running 3.30.00.03 to and from the zig-a-zig-ah! running 4.10.00.78.
Perform an energy scan to find a quiet Zigbee channel:
$ python -m zigpy_znp.tools.energy_scan /dev/cu.usbmodem14101
2020-08-15 14:24:09 computer __main__[12018] INFO Starting up zigpy-znp
2020-08-15 14:24:12 computer zigpy_znp.api[12018] WARNING Received an unhandled command: AppConfig.BDBCommissioningNotification.Callback(Status=<BDBCommissioningStatus.NetworkRestored: 13>, Mode=<BDBCommissioningMode.NONE: 0>, RemainingModes=<BDBCommissioningMode.NwkFormation: 4>)
2020-08-15 14:24:13 computer zigpy_znp.zigbee.application[12018] INFO Using channel mask Channels.CHANNEL_15, currently on channel 15
2020-08-15 14:24:13 computer __main__[12018] INFO Running scan...
2020-08-15 14:24:13 computer zigpy_znp.api[12018] WARNING Received an unhandled command: AppConfig.BDBCommissioningNotification.Callback(Status=<BDBCommissioningStatus.FormationFailure: 8>, Mode=<BDBCommissioningMode.NwkSteering: 2>, RemainingModes=<BDBCommissioningMode.NONE: 0>)
Channel energy (1 / 5):
- 11: 0.00%
- 12: 0.39%
- 13: 0.39%
- 14: 1.02% #
- 15: 1.80% #
- 16: 8.00% ########
- 17: 10.27% ##########
- 18: 9.41% #########
- 19: 6.75% ######
- 20: 0.00%
- 21: 5.33% #####
- 22: 2.20% ##
- 23: 8.63% ########
- 24: 2.82% ##
- 25: 0.00%
- 26: 0.55%
USB-adapters, GPIO-modules, and development-boards running recent TI Z-Stack releases (above version 3.0.0) are supported. Reference hardware for this project includes:
- (STABLE) TI LAUNCHXL-CC26X2R1 running Z-Stack 3.30.00.03. You can flash
CC26X2R1_20191106.hex
using TI's UNIFLASH. - (STABLE) Electrolama's zig-a-zig-ah! running Z-Stack 4.10.00.78. You can flash
CC26X2R1_20200417.hex
using cc2538-bsl. - (ALPHA) CC2531 running Z-Stack 3.0.1. You can flash
CC2531ZNP-without-SBL.bin
to your stick directly withzigpy_znp
:python -m zigpy_znp.tools.flash_write -i /path/to/CC2531ZNP-without-SBL.bin /dev/serial/by-id/YOUR-CC2531
.
Older versions of Z-Stack are not currently supported. Z-Stack versions 3.x and above are currently required and all communication with the radio module is done over the the Z-Stack Monitor and Test (MT) interface via a serial port.
Texas Instruments (TI) has quite a few different wireless MCU chips and they are all used/mentioned in open-source Zigbee world which can be daunting if you are just starting out. Here is a quick summary of part numbers and key features.
- CC2652R = 2.4GHz only wireless MCU for IEEE 802.15.4 multi-protocol (Zigbee, Bluetooth, Thread, IEEE 802.15.4g IPv6-enabled smart objects like 6LoWPAN, and proprietary systems). Cortex-M0 core for radio stack and Cortex-M4F core for application use, plenty of RAM. Free compiler option from TI.
- CC2652RB = Pin compatible "Crystal-less" CC2652R (so you could use it if you were to build your own zzh and omit the crystal) but not firmware compatible.
- CC2652P = CC2652R with a built-in RF PA. Not pin or firmware compatible with CC2652R/CC2652RB.
- CC1352R = Sub 1 GHz & 2.4 GHz wireless MCU. Essentially CC2652R with an extra sub-1GHz radio.
- CC1352P = CC1352R with a built in RF PA.
- CC2591 and CC2592 = 2.4 GHz range extenders. These are not wireless MCUs, just auxillary PA (Power Amplifier) and LNA (Low Noise Amplifier) in the same package to improve RF (Radio Frequency) range of any 2.4 GHz radio chip.
Tagged versions will also be released via PyPI
- https://pypi.org/project/zigpy-znp/
- https://pypi.org/project/zigpy-znp/#history
- https://pypi.org/project/zigpy-znp/#files
If you are looking to make a code or documentation contribution to this project we suggest that you follow the steps in these guides:
- https://github.com/firstcontributions/first-contributions/blob/master/README.md
- https://github.com/firstcontributions/first-contributions/blob/master/github-desktop-tutorial.md
zigpy is Zigbee protocol stack integration project to implement the Zigbee Home Automation standard as a Python library. Zigbee Home Automation integration with zigpy allows you to connect one of many off-the-shelf Zigbee adapters using one of the available Zigbee radio library modules compatible with zigpy to control Zigbee devices. There is currently support for controlling Zigbee device types such as binary sensors (e.g. motion and door sensors), analog sensors (e.g. temperature sensors), lightbulbs, switches, and fans. Zigpy is tightly integrated with Home Assistant's ZHA component and provides a user-friendly interface for working with a Zigbee network.