No description
- C 98.9%
- CMake 1.1%
| main | ||
| .gitignore | ||
| CMakeLists.txt | ||
| dependencies.lock | ||
| partitions.csv | ||
| README.md | ||
| sdkconfig | ||
| sdkconfig.defaults | ||
Esp32-C6 zigbee air and light sensor
ESP-IDF Zigbee sensor project for ESP32-C6 that reads environmental data from an AHT10 (temperature + humidity), a VEML7700 (ambient light), and a BMP280/BME280 (atmospheric pressure) sensor and publishes the values as Zigbee cluster attributes.
Hardware
| Signal | ESP32-C6 GPIO (default) |
|---|---|
| I²C SDA | GPIO 0 |
| I²C SCL | GPIO 1 |
| AHT10 addr | 0x38 (ADDR → GND) |
| VEML7700 addr | 0x10 (fixed) |
| BMP280/BME280 addr | 0x76 |
All three sensors share a single I²C bus. The BMP280 is optional — if it fails to initialise, the device continues with just the AHT10 and VEML7700.
Zigbee clusters (endpoint 10)
| Cluster | ID | Attribute | Scaling |
|---|---|---|---|
| Temperature Measurement | 0x0402 | MeasuredValue (int16) | °C × 100 (2500 = 25.00 °C) |
| Relative Humidity Measurement | 0x0405 | MeasuredValue (uint16) | % × 100 (5500 = 55.00 %) |
| Illuminance Measurement | 0x0400 | MeasuredValue (uint16) | 10 000 × log₁₀(lux) + 1 |
| Pressure Measurement | 0x0403 | MeasuredValue (int16) | hPa (rounded) |
Device type: Zigbee End Device (ZED), HA profile 0x0104.
Prerequisites
- ESP-IDF v5.2 or newer – install via the Getting Started guide.
- Target chip ESP32-C6 (the only supported SoC here).
Clone / submodule setup
git clone https://git.kabilov.com/murat/esp_zigbee_airsensor.git
cd esp_zigbee_airsensor
Configuration (optional)
Run idf.py menuconfig and navigate to Air Zigbee Sensor:
| Config key | Default | Description |
|---|---|---|
CONFIG_I2C_SDA_GPIO |
0 | I²C SDA GPIO |
CONFIG_I2C_SCL_GPIO |
1 | I²C SCL GPIO |
CONFIG_SENSOR_POLL_INTERVAL_MS |
5000 | Sensor polling period (ms) |
CONFIG_ZIGBEE_ENDPOINT_ID |
10 | Zigbee AF endpoint ID (1–240) |
Build & flash
idf.py set-target esp32c6
idf.py build flash monitor
Replace /dev/ttyUSB0 with your actual serial port.
Runtime behaviour
- On first boot the device performs Zigbee network steering to join an open coordinator/router.
- Once joined, the I²C sensors are initialised and a polling task starts. If the BMP280 fails to initialise, the device logs a warning and continues with the remaining sensors.
- Every
CONFIG_SENSOR_POLL_INTERVAL_MSms the sensors are read and the ZCL attributes are updated. - If a sensor read fails, a warning is logged and the cycle retries next interval.
- Network credentials are stored in the
zb_storageNVS partition and survive power cycles.
Factory reset
To clear network credentials and restart commissioning, erase the
zb_storage partition:
idf.py erase-flash