libraries/Zigbee/examples/Zigbee_Illuminance_Sensor/README.md
This example demonstrates how to use the Zigbee library to create an end device illuminance sensor and use it as a Home Automation (HA) extended illuminance sensor.
Currently, this example supports the following targets.
| Supported Targets | ESP32-C6 | ESP32-H2 |
|---|
In this example the raw analog value of a light sensor is used to calculate illuminance.
Alter the calculation according to your use case and calibrate it to receive correct lux values.
Set the illuminance sensor GPIO by changing the illuminance_sensor_pin variable to the pin to the pin to which your sensor is connected.
Set the button GPIO by changing the button variable. By default, it's the pin BOOT_PIN (BOOT button on ESP32-C6 and ESP32-H2).
To get more information about the Espressif boards see Espressif Development Kits.
Tools -> Board.Tools -> Zigbee mode: Zigbee ED (end device)Tools -> Partition Scheme: Zigbee 4MB with spiffsTools -> USB CDC On Boot: EnabledTools -> Port: xxx where the xxx is the detected COM port.Tools -> Core Debug Level: Verbose.If the End device flashed with this example is not connecting to the coordinator, erase the flash of the End device before flashing the example to the board. It is recommended to do this if you re-flash the coordinator. You can do the following:
Erase All Flash Before Sketch Upload to Enabled.Zigbee.factoryReset(); to reset the device and Zigbee stack.By default, the coordinator network is closed after rebooting or flashing new firmware. To open the network you have 2 options:
Zigbee.setRebootOpenNetwork(time); before calling Zigbee.begin();.Zigbee.openNetwork(time); to open the network for devices to join.Important: Make sure that you are using a good quality USB cable with data lines and that you have a reliable power source
If the error persists, you can ask for help at the official ESP32 forum or see Contribute.
To know how to contribute to this project, see How to contribute.
If you have any feedback or issue to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome!
Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else.