esphome_zb_sensor icon indicating copy to clipboard operation
esphome_zb_sensor copied to clipboard

Example of a zigbee sensor in esphome

[!IMPORTANT] This implementation is outdated: Use the external zigbee component for easier setup and more functionality.

ESPHome Zigbee sensor using ESP32-H2

ESPHome example of a zigbee sensor.

Note that the Zigbee part in this project is currently hardcoded and included as a custom component including a task. (Changing this to an external component with more configuration possibilities would be the next step).

Zigbee based temperature and humidity sensor

ESPHome Zigbee sensor connected to AHT10 Temperature+Humidity Sensor.

Hardware Required

  • One development board with ESP32-H2 SoC acting as Zigbee end-device (that you will load ESPHome with the zb-sensor config to).
  • AHT10/AHT20/AHT30 Temperature+Humidity Sensor connected to I2C pins (SDA: 12, SCL: 22).
  • A USB cable for power supply and programming.
  • (Optional) A USB-C cable to get ESP32 logs from the UART USB port (UART0).

Build ESPHome Zigbee sensor

Steps

  • Change the AHTx0 variant in ZB_sensor.yaml file according to the sensor you have
  • Build with esphome run ZB_sensor.yaml command will fail
  • Copy idf_component.yml to .esphome/build/zb-sensor/src/
  • Add the following 4 lines to the .esphome/build/zb-sensor/sdkconfig.zb-sensor file
CONFIG_ZB_ENABLED=y
CONFIG_ZB_RADIO_NATIVE=y
CONFIG_ZB_ZED=y
ZB_ED_ROLE=y
  • Build with esphome run ZB_sensor.yaml command
  • Firmware will be uploaded automatically to the ESP32-H2 board

Notes

  • There is a bug in ESPHome 2024.3.0. Deactivate the logger to make it build.
  • If library versions in idf_component.yml are changed, copy the file to .esphome/build/zb-sensor/src/ again and delete .esphome/build/zb-sensor/.pioenvs.

Variants:

External documentation and reference

Note! The official documentation and reference examples for the ESP Zigbee SDK can currently be obtained from Espressif:

How to contribute

If looking to contribute to this project then suggest follow steps in these guides + look at issues in Espressif's ESP Zigbee SDK repoository:

  • https://github.com/espressif/esp-zigbee-sdk/issues
  • https://github.com/firstcontributions/first-contributions/blob/master/README.md
  • https://github.com/firstcontributions/first-contributions/blob/master/github-desktop-tutorial.md