feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

[REQUEST] ESPHome firmware as a Zigbee to MQTT bridge/gateway on hardware like ITead Sonoff Zigbee Bridge (Sonoff ZBBridge)

Open Hedda opened this issue 5 years ago • 6 comments

Describe the problem you have/What new integration you would like

Please consider making ESPHome firmware as a Zigbee Gateway to MQTT-bridge on hardware like example ITead Sonoff Zigbee Bridge (Sonoff ZBBridge), i.e. features to use ESPHome with Zigbee Coordinator radio and a native Zigbee Gateway implementation to allow connect Zigbee devices and then bridging them to expose those devices via MQTT.

As a proof-of-concept the Zigbee2Tasmota (a.k.a. Z2T, Tasmota-to-Zigbee) project can already do this, see::

  • https://tasmota.github.io/docs/Zigbee/

The original inspiration for this request is that Itead has just launched "Sonoff ZBBridge" as an very inexpensive Zigbee Bridge/gateway which combines ESP32 SoC with a Zigbee Coordinator chip, and then came ZB-GW03 eWeLink Ethernet Zigbee Gateway which was now hacked with ESPHome and Tasmota so can be used via MQTT or as a remote Zigbee Coordinator LAN adapter with Home Assistant’s ZHA integration or Zigbee2MQTT or be used as a full all-in-one Zigbee Gateway to MQTT bridge implementation using the above mentioned Zigbee2Tasmota (a.k.a. Z2T, Tasmota-to-Zigbee) project:

  • https://community.home-assistant.io/t/zb-gw03-ewelink-ethernet-zigbee-gateway-now-hacked-with-esphome-and-tasmota-so-can-be-used-via-mqtt-or-as-a-remote-zigbee-coordinator-lan-adapter-with-home-assistants-zha-integration-or-zigbee2mqtt/341223

Please describe your use case for this integration and alternatives you've tried:

The use case is to build a stand-alone Zigbee-gateway to MQTT-bridge using ESPHome on a ESP32 with a Zigbee radio, and to achieve that you would need to run the whole Zigbee stack and the Zigbee gateway application implementation natively on the ESP32 as well as a MQTT client to allow you to connect and bridge Zigbee devices to MQTT.

Additional context

Update: FYI, that is now also new ESP32-H2 + ESP32-C3 combo development board kit and ESP Thread Boarder Router SDK that can be used as reference hardware. It has as been certified as a Thread Border Router but can also be used as an as Zigbee gateway/hub or bridge (and they also got an optional Ethernet Sub-Board for it):

https://www.cnx-software.com/2023/06/20/espressif-esp-thread-border-router-board-combines-esp32-h2-esp32-c3-wireless-chips/

https://github.com/espressif/esp-thread-br

https://docs.espressif.com/projects/esp-thread-br/en/latest/esp32/

https://www.aliexpress.us/item/1005005688193617.html

PS: An earlier two-board ESP Thread Border Router solution was previously available as an example project for reference:

https://github.com/espressif/esp-idf/tree/master/examples/openthread/ot_br

https://openthread.io/guides/border-router/espressif-esp32

image

and optional Optional Ethernet Sub Board

image

Hedda avatar Apr 16 '20 11:04 Hedda

Please note that #681 and #688 are two sperate requests with different goals.

  • Request #681 ask for ESPHome to be a smart Zigbee gateway which translate Zigbee to MQTT.
  • Request #688 ask for ESPHome to be a dumb Zigbee gateway which only forwards the serial port.

Hedda avatar Apr 20 '20 13:04 Hedda

FYI, there are now several ESP32 based gateways which contain either Silicon Labs EFR32MG21 or Texas Instruments CC2652P Zigbee Coordinator radio modules sold and many of them are open-source hardware with schematics for DIY builds. See example:

https://zig-star.com/projects/zigbee-gw-lan/

https://github.com/mercenaruss/zigstar_gateways

https://www.tubeszb.com

https://github.com/tube0013/tube_gateways/

Those have benefits of their makers being active members of the Home Assistant community and their support so far is great!

https://community.home-assistant.io/t/zigstar-zigbee-coordinators-and-routers/338586/

https://community.home-assistant.io/t/tubes-zb-coordinators-and-routers-was-zigbee-router-on-steroids/280896

ITead have also released a new ESP32 based product based ZBBridge-P (a.k.a. "ZB Bridge-P") with TI CC2652P Zigbee radio:

https://itead.cc/product/sonoff-zigbee-bridge-pro/

That "Sonoff Zigbee Bridge Pro" has already been hacked by the Tasmota community which can now use it with Zigbee2Tasmota:

https://github.com/arendst/Tasmota/discussions/14419

https://tasmota.github.io/docs/Zigbee/

Hedda avatar Jun 13 '22 08:06 Hedda

FYI, Espressif themselves now seems to focus on ESP's one-stop Zigbee Gateway solution, i.e., the two chips solution using an ESP32-S3 Wi-Fi SoC for the Zigbee Gateway/Bridge application part paired together via UART-serial to an ESP32-H 802.15.4 SoC as a dedicated radio chip for Zigbee (or Thread/OpenThead), where a typical use case example would be a Zigbee to Matter Bridge (or Thread/OpenThead to Matter Bridge).

  • https://www.espressif.com/en/news/ESP32_H2

  • https://github.com/espressif/esp-idf/tree/master/examples/zigbee/

    • https://github.com/espressif/esp-matter/tree/main/examples/zigbee_bridge
    • https://github.com/espressif/esp-idf/tree/master/examples/zigbee/esp_zigbee_gateway
    • https://github.com/espressif/esp-idf/blob/master/examples/zigbee/esp_zigbee_rcp

and

  • https://github.com/espressif/esp-zboss-lib

or

  • https://github.com/espressif/esp-idf/tree/master/examples/openthread/ot_rcp

and for optionally adding Matter support on top of that see Project-CHIP:

  • https://github.com/project-chip/connectedhomeip/tree/master/examples/
    • https://github.com/project-chip/connectedhomeip/tree/master/examples/bridge-app/
    • https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool

Note that even with that type of combination solution with a dedicated 802.15.4 radio chip for Zigbee (or Thread/OpenThead), there is still an option to use an alternative third-party 802.15.4 SoC such as Nordic Semiconductor nRF5/nRF52 (nRF52840), Texas Instruments CC2652/CC1352, or Silicon Labs EFR32MG21/EFR32MG24, instead of the new ESP32-H 802.15.4 SoC.

Hedda avatar Sep 30 '22 07:09 Hedda

What about the ESP32-C6 RISC-V with built in Zigbee?

lachesis avatar May 30 '23 02:05 lachesis

What about the ESP32-C6 RISC-V with built in Zigbee?

Check out this separate feature request for ESP32-C6 support (which requires the upcoming ESP-IDF 5.1 to be released) -> https://github.com/esphome/feature-requests/issues/2176

Also check this other feature request for Zigbee (and Thread) support on ESP32-H2 which has the same 802.15.4 radio -> https://github.com/esphome/feature-requests/issues/1397

The hurdle with those is they require support for ESP ZBOSS 3.0 binary libraries supporting the Zboss Zigbee 3.0 stack for ESP32.

Or for Home Assistant's ZHA integration pass-through support need a ZBOSS radio library for zigpy (e.g. zigpy-zboss), check out:

https://github.com/kardia-as/zigpy-zboss

ESP ZBOSS 3.0 Libraries

This repository contains binary libraries supporting the Zboss Zigbee 3.0 stack for ESP32 series chips.

https://github.com/espressif/esp-zboss-lib

Packages from this repository are uploaded to Espressif’s component serivce. You can add them to your project via idf.py add-dependency

More information about idf-component-manager can be found in Espressif API guide or PyPi registry.

There now looks to be some Zigbee examples in Espressif’s IoT Development Framework (ESP-IDF):

https://components.espressif.com/component/espressif/esp-zboss-lib

https://www.espressif.com/en/products/sdks/esp-idf

https://github.com/espressif/esp-idf

https://github.com/espressif/esp-idf/tree/master/examples/zigbee

Those examples include; Zigbee coordinator ("light coordinator"), "Zigbee RCP (radio co-processor"), and "Zigbee gateway":

https://github.com/espressif/esp-idf/tree/master/examples/zigbee/light_sample/light_coordinator

"light_coordinator is a light coordinator example demonstrating Zigbee Coordinator role. It provides a formation of the Zigbee network. It runs on an 802.15.4 SoC like ESP32-H2. For more details to see the example readme file."

https://github.com/espressif/esp-idf/tree/master/examples/zigbee/esp_zigbee_rcp

https://github.com/espressif/esp-idf/tree/master/examples/zigbee/esp_zigbee_gateway

Wondering if "RPC" works similar to Silicon Labs RPC which works like a dumb radio requiring external ESP ZBOSS 3.0 libraries?

https://components.espressif.com/component/espressif/esp-zboss-lib

"This test code shows how to configure Zigbee rcp (radio co-processor) device. Rcp doesn't function alone, it needs to work together with Zigbee gateway (see esp_zigbee_gateway example)"

"After rcp starts up, it will send its own MAC ieee address and Zigbee stack version number to the Zigbee gateway and start working together with Zigbee gateway via UART communication"

ESP32-H2 has apparently now also already been certified as a “Zigbee Compliant Platform” by CSA¨ :

Hedda avatar Jun 20 '23 06:06 Hedda

What about the ESP32-C6 RISC-V with built in Zigbee?

Check out this separate feature request for ESP32-C6 support (which requires the upcoming ESP-IDF 5.1 to be released) -> #2176

Also check this other feature request for Zigbee (and Thread) support on ESP32-H2 which has the same 802.15.4 radio -> #1397

The hurdle with those is they require support for ESP ZBOSS 3.0 binary libraries supporting the Zboss Zigbee 3.0 stack for ESP32.

Or for Home Assistant's ZHA integration pass-through support need a ZBOSS radio library for zigpy (e.g. zigpy-zboss), check out:

https://github.com/kardia-as/zigpy-zboss

FYI, that is now a new ESP32-H2 + ESP32-C3 combo development board kit and ESP Thread Boarder Router SDK that can be used as reference hardware. It has as been certified as a Thread Border Router (TBR) / OpenThread Border Router (OTBR) which can be used for Matter based on the Thread 1.3 standard, alternatively be used as an as Zigbee gateway/hub or bridge, and they also got an optional Ethernet Sub-Board

https://www.cnx-software.com/2023/06/20/espressif-esp-thread-border-router-board-combines-esp32-h2-esp32-c3-wireless-chips/

https://github.com/espressif/esp-thread-br

https://docs.espressif.com/projects/esp-thread-br/en/latest/esp32/

https://www.aliexpress.us/item/1005005688193617.html

PS: An earlier two-board ESP Thread Border Router solution was previously available as an example project for reference:

https://github.com/espressif/esp-idf/tree/master/examples/openthread/ot_br

https://openthread.io/guides/border-router/espressif-esp32

image

and optional Optional Ethernet Sub Board

image

Hedda avatar Jun 20 '23 07:06 Hedda