ESP32-H2/ESP32-C6 with Zigbee NCP firmware will soon be usable as remote Zigbee Coordinator for the ZHA integration via new radio library for zigpy

FYI, an ESP32-H2 or ESP32-C6 SoC flashed with “ZNSP” (Espressif Zigbee NCP Serial Protocol) firmware image will soon be usable as a remote (Serial-over-IP proxy/relay) Zigbee Coordinator radio adapter with Home Assistant’s native ZHA integration component via new “zigpy-espzb” radio library for zigpy. Check out this project:

Note! zigpy-espzb is experimental and not available from PyPI + has no pre-built firmware images yet.

Also note that the zigpy-espzb project is not meant to allow you to use ESP32-H2/ESP32-C6 as a Zigbee device (i.e. Zigbee End Device or Zigbee Router devices), instead, it will only enable you to use an ESP32-H2/ESP32-C6 flashed with a Zigbee NCP firmware image as a remote Zigbee Coordinator radio adapter (using Serial-over-IP proxy/relay) with a zigpy based Zigbee gateway application (such as Home Assistant’s built-in ZHA (Zigbee Home Automation) integration component → Zigbee Home Automation - Home Assistant ).

This is related to a zigpy feature request asking to use ESP32-C6/ESP32-H2 as a Zigbee Coordinator:

PS: This is similar news to new → Nordic Semi nRF52840 chips with ZBOSS Zigbee stack now usable as Zigbee Coordinator for the ZHA integration via new radio library for zigpy as it as Espressif’s Zigbee stack are based on the same underlying Zigbee stack (DRS ZOI - ZBOSS Open Initiative), though Espressif have chosen to abstract that with their own custom CLI/API implementations available via their Zigbee SDK:

zigpy-espzb

zigpy-espzb is a Python 3 implementation to implement support for Espressif ZNSP (Zigbee NCP Serial Protocol) based Zigbee radio adapters with the zigpy library (an open-source Python Zigbee stack project).

The goal of this project is to native Zigbee Coordinator radio adapter support using Zigbee NCP (Network Co-Processor) application firmware with Espressif Systems ESP32-C6/ESP32-H2 based Zigbee modules via the zigpy project.

This together with the zigpy library and a home automation software application with compatible Zigbee gateway implementation, like the Home Assistant’s ZHA (Zigbee Home Automation) integration component, you can directly control other Zigbee devices from most product manufacturers.

Back-story and use cases

Note! Zigbee NCP support for ESP32 is still in very early development in Espressif Zigbee SDK (based on DSR ZBOSS stack as part of “ZBOSS Open Initiative”, a.k.a. ZOI). It is currently compatible with ESP32-C6 and ESP32-H2, both containing 802.15.4 radio, and are officially recognized as Zigbee-Compliant platforms by the CSA (Connectivity Standards Alliance, formerly the Zigbee Alliance), of which Espressif is a board and promoter member.

Development is initially focused on Zigbee Coordinator functionality using “ESP Thread Border Router SDK” development kit hardware. That implementation provides an all-in-one embedded Zigbee (or Thread) to Wi-Fi Serial-over-IP proxy solution, with the board designed using two-SoC set-up consisting of an ESP32-H2 SoC for Zigbee (or Thread) in combination with an ESP32-S3 SoC (with internal UART/SPI communication) for Wi-Fi/Ethernet bridging.

Alternative to the ESP32-H2 (which only supports 802.15.4), the ESP32-C6 SoC/module development board was launched more recently and features built-in WiFi 6, BLE 5.0, and 802.15.4, including Zigbee (or Thread), all on the same chip. It could thus be used as a single-chip Zigbee Coordinator Serial-over-IP proxy solution over Wi-Fi, or over Ethernet physical layer if combined with a PHY Ethernet implementation on a board for RJ45 wired connection.

Hardware requirements

Supported targets are ESP32-H2 and ESP32-C6, tested with the official devkits and modules from Espressif as reference hardware:

Development is primarily being done with Espressif’s ESP Thread Border Router SDK hardware (based on ESP32-H2-MINI-1 module):

Firmware

Development and testing in the zigpy-espzb project are done with a firmware image built using the ZNSP NCP host example from Espressif:

Compatible compiled ZNSP NCP host firmware images are required to be flashed on the ESP32-C6 or ESP32-H2 device with a serial connection.

Precompiled images might be provided in the future.

External documentation and reference

Note! The official documentation for the ZNSP can currently be obtained from Espressif Systems:

How to contribute

If you are looking to contribute to this project or upstream we suggest that you post an issue and follow the steps in these guides:

Some developers might also be interested in receiving donations in the form of hardware such as Zigbee modules or devices, and even if such donations are most often donated with no strings attached it could in many cases help the developers motivation and indirect improve the development of this project.

Other radio libraries for zigpy to use as reference projects

zigpy-znp

The zigpy-znp zigpy radio library for Texas Instruments Z-Stack ZNP interface and has been used a reference to base the zigpy-espzb and nrf-zboss-ncp radio libraries on. zigpy-znp is very stable with TI Z-Stack 3.x.x and (zigpy-znp also offers some stand-alone CLI tools that are unique for Texas Instruments hardware and Zigbee stack.

zigpy-zboss

The zigpy-zboss zigpy radio library for nRF ZBOSS NCP. The development of the zigpy-zboss radio library for zigpy in turn stems from information learned from the work in the zigpy-znp project.

zigpy-deconz

The zigpy-deconz is another mature radio library for Dresden Elektronik’s deCONZ Serial Protocol interface that is used by the deconz firmware for their ConBee and RaspBee seriies of Zigbee Coordinator adapters. Existing zigpy developers previous advice has been to also look at zigpy-deconz since it is somewhat similar to the ZBOSS serial protocol implementation.

zigpy deconz parser

zigpy-deconz-parser allow developers to parse Home Assistant’s ZHA component debug logs using the zigpy-deconz radio library if you are using a deCONZ based adapter like ConBee or RaspBee.

bellows

The bellows is made Silicon Labs EZSP (EmberZNet Serial Protocol) interface and is another mature zigpy radio library project worth taking a look at as a reference, (as both it and some other zigpy radio libraires have some unique features and functions that others do not).

Related projects

zigpy

zigpy is a 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.

zigpy-cli (zigpy command line interface)

zigpy-cli is a unified command line interface for zigpy radios. The goal of this project is to allow low-level network management from an intuitive command line interface and to group useful Zigbee tools into a single binary.

ZHA Device Handlers

ZHA deviation handling in Home Assistant relies on the third-party ZHA Device Handlers project (also known unders zha-quirks package name on PyPI). Zigbee devices that deviate from or do not fully conform to the standard specifications set by the Zigbee Alliance may require the development of custom ZHA Device Handlers (ZHA custom quirks handler implementation) to for all their functions to work properly with the ZHA component in Home Assistant. These ZHA Device Handlers for Home Assistant can thus be used to parse custom messages to and from non-compliant Zigbee devices. The custom quirks implementations for zigpy implemented as ZHA Device Handlers for Home Assistant are a similar concept to that of Hub-connected Device Handlers for the SmartThings platform as well as that of zigbee-herdsman converters as used by Zigbee2mqtt, meaning they are each virtual representations of a physical device that expose additional functionality that is not provided out-of-the-box by the existing integration between these platforms.

ZHA integration component in Home Assistant

ZHA integration component for Home Assistant (depending on the zigpy library) is a Zigbee gateway implementation as integrated into the core of Home Assistant (a Python based open source home automation software). There are also other GUI and non-GUI projects for Home Assistant’s ZHA components which builds on or depends on its features and functions to enhance or improve its user-experience, some of those are listed and linked below.

If anyone wants to help the HA community test the zigpy-espzb radio library with Home Assistant’s ZHA integration then please consider building/maintaining compiled firmware images are needed for testing:

If someone in the community would be willing to maintain a repository for community firmware builds for ESP32-C6 and ESP32-H2 then it would be possible to make a DIY network-attached Serial-to-IP proxy solution (similar to TubesZB’s Zigbee Gatways and ZigStar’s Zigbee Gateways) by otherwise following Espressif’s hardware reference design instructions for a " ESP Thread Border Router Board" (which is a two-SoC or two-board solution based on one ESP32-S3 in combination with either a ESP32-C6 or a ESP32-H2:

The following image shows examples connection between ESP32 DevKitC and ESP32-H2 DevKitC:

ESP Thread border router board provides an integrated modules with a ESP32-S3 SoC and a ESP32-H2:

Otherwise can use a direct serial connection via USB-to-Serial converter chip or external programmer:

https://docs.espressif.com/projects/esp-idf/en/stable/esp32h2/get-started/establish-serial-connection.html

Following shows the USB-to-UART Bridge on ESP32-C6-DevKit and ESP32-H2-DevKit dev boards:

Anyone up to the task of writing a step-by-step guide for building and compiling Espressif ZNSP Zigbee NCP firmware for ESP32-C6/ESP32-H2 to use with zigpy-espzb as well as a setup/configuration how-to manual for alpha/beta testers and new developers?

I would actually be in for writing a guide, however with my self-adjusted zha addon i only get a “cannot_connect” error message when manually specifying the details:

  • serial=/dev/ttyACM0
  • baudrate=115200 (as i specified in idf menuconfig)
  • radio button = tried all 3 options (hardware, software, empty)

When i “screen” the device file, i do get it’s complete boot log and i’m not sure if i’m supposed to get that on the uart output (configured rx/tx to 17/16).

Developers wanting to assist with this radio library project can help write and submit additonal unit tests:

For reference please see tests directory for bellows, zigpy-znp, and zigpy-deconz radio libraries: