Skip to content

Commit 62c0666

Browse files
committed
feat(zigbee): Add temp sensor and thermostat example
1 parent de21f04 commit 62c0666

File tree

18 files changed

+1106
-1
lines changed

18 files changed

+1106
-1
lines changed

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ You can do the following:
3939
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`
4040
* In the sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
4141

42+
By default, the coordinator network is open for 180s after rebooting or flashing new firmware. After that, the network is closed for adding new devices.
43+
You can change by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
44+
4245
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
4346

4447
* **LED not blinking:** Check the wiring connection and the IO selection.

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ You can do the following:
3939
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
4040
* In the `Zigbee_Light_Bulb` example sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
4141

42-
By default the coordinator network is open for 180s after rebooting or flashing new firmware. After that the network is closed for adding new devices.
42+
By default, the coordinator network is open for 180s after rebooting or flashing new firmware. After that, the network is closed for adding new devices.
4343
You can change by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
4444

4545
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Temperature_Sensor/.skip.esp32

Whitespace-only changes.

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Temperature_Sensor/.skip.esp32c3

Whitespace-only changes.

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Temperature_Sensor/.skip.esp32c6

Whitespace-only changes.

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Temperature_Sensor/.skip.esp32h2

Whitespace-only changes.

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Temperature_Sensor/.skip.esp32s2

Whitespace-only changes.

Diff for: libraries/ESP32/examples/Zigbee/Zigbee_Temperature_Sensor/.skip.esp32s3

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Arduino-ESP32 Zigbee Temperature Sensor Example
2+
3+
This example shows how to configure the Zigbee end device and use it as a HA temperature sensor.
4+
5+
**This example is based on ESP-Zigbee-SDK example esp_zigbee_HA_sample/HA_temperature_sensor.**
6+
7+
# Supported Targets
8+
9+
Currently, this example supports the following targets.
10+
11+
| Supported Targets | ESP32-C6 | ESP32-H2 |
12+
| ----------------- | -------- | -------- |
13+
14+
## Temperature Sensor Functions
15+
16+
Note:
17+
* This board means the board (e.g. ESP32-H2) loaded with `Zigbee_Temperature_Sensor` example.
18+
* The remote board means the board (e.g. ESP32-H2) loaded with `Zigbee_Thermostat` example.
19+
20+
Functions:
21+
* After this board first starts up, it would be configured locally to report the temperature on 1 degree change and no periodic reporting to the remote board.
22+
* By clicking the switch button (BOOT) on this board, this board will immediately send a report of the current measured temperature to the remote board.
23+
24+
## Hardware Required
25+
26+
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee coordinator (loaded with `Zigbee_Thermostat` example)
27+
* A USB cable for power supply and programming
28+
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee end device (loaded with `Zigbee_Temperature_Sensor` example)
29+
30+
### Configure the Project
31+
32+
In this example, the temperature sensor task is reading the chip temperature.
33+
Set the Button Switch GPIO by changing the `GPIO_INPUT_IO_TOGGLE_SWITCH` definition. By default, it's the `GPIO_NUM_9` (BOOT button on ESP32-C6 and ESP32-H2).
34+
35+
#### Using Arduino IDE
36+
37+
To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits).
38+
39+
* Before Compile/Verify, select the correct board: `Tools -> Board`.
40+
* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)`
41+
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`
42+
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
43+
44+
## Troubleshooting
45+
46+
If the End device flashed with this example is not connecting to the coordinator, erase the flash before flashing it to the board. It is recommended to do this if you did changes to the coordinator.
47+
You can do the following:
48+
49+
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`
50+
* In the sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
51+
52+
By default, the coordinator network is open for 180s after rebooting or flashing new firmware. After that, the network is closed for adding new devices.
53+
You can change by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
54+
55+
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
56+
57+
* **LED not blinking:** Check the wiring connection and the IO selection.
58+
* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed.
59+
* **COM port not detected:** Check the USB cable and the USB to Serial driver installation.
60+
61+
If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute).
62+
63+
## Contribute
64+
65+
To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst)
66+
67+
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!
68+
69+
Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else.
70+
71+
## Resources
72+
73+
The ESP Zigbee SDK provides more examples:
74+
* ESP Zigbee SDK Docs: [Link](https://docs.espressif.com/projects/esp-zigbee-sdk)
75+
* ESP Zigbee SDK Repo: [Link](https://github.com/espressif/esp-zigbee-sdk)
76+
77+
* Official ESP32 Forum: [Link](https://esp32.com)
78+
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
79+
* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf)
80+
* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf)
81+
* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf)
82+
* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf)
83+
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)

0 commit comments

Comments
 (0)