Skip to content

Commit 97920df

Browse files
committed
Dev Update: Thermostat and Temperature sensor EP
Implemeted thermostat and temperature sensor HA devices + examples. Implemented configure report handler. Updated READMEs and description of examples. Minor code updates
1 parent ef1cc89 commit 97920df

File tree

27 files changed

+864
-189
lines changed

27 files changed

+864
-189
lines changed

libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Arduino-ESP32 Zigbee Light Bulb Example
1+
# Arduino-ESP32 Zigbee Color Dimmable Light Example
22

3-
This example shows how to configure the Zigbee end device and use it as a Home Automation (HA) on/off light bulb.
4-
5-
**This example is based on ESP-Zigbee-SDK example esp_zigbee_HA_sample/HA_on_off_light.**
3+
This example shows how to configure the Zigbee end device and use it as a Home Automation (HA) color dimmable light.
64

75
# Supported Targets
86

@@ -13,14 +11,13 @@ Currently, this example supports the following targets.
1311

1412
## Hardware Required
1513

16-
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee coordinator (loaded with Zigbee_Light_switch example)
14+
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee coordinator (loaded with Zigbee_Color_Dimmer_Switch example)
1715
* A USB cable for power supply and programming
18-
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee end device (loaded with Zigbee_Light_bulb example)
16+
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee end device and upload the Zigbee_Color_Dimmable_Light example
1917

2018
### Configure the Project
2119

2220
Set the LED GPIO by changing the `LED_PIN` definition. By default, the LED_PIN is `RGB_BUILTIN`.
23-
By default, the `neoPixelWrite` function is used to control the LED. You can change it to digitalWrite to control a simple LED.
2421

2522
#### Using Arduino IDE
2623

@@ -60,14 +57,8 @@ Before creating a new issue, be sure to try Troubleshooting and check if the sam
6057

6158
## Resources
6259

63-
The ESP Zigbee SDK provides more examples:
64-
* ESP Zigbee SDK Docs: [Link](https://docs.espressif.com/projects/esp-zigbee-sdk)
65-
* ESP Zigbee SDK Repo: [Link](https://github.com/espressif/esp-zigbee-sdk)
66-
6760
* Official ESP32 Forum: [Link](https://esp32.com)
6861
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
69-
* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf)
70-
* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf)
71-
* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf)
72-
* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf)
62+
* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf)
63+
* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf)
7364
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)

libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/Zigbee_Color_Dimmable_Light.ino

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
// limitations under the License.
1414

1515
/**
16-
* @brief This example demonstrates simple Zigbee light bulb.
16+
* @brief This example demonstrates Zigbee Color Dimmable light bulb.
1717
*
18-
* The example demonstrates how to use ESP Zigbee stack to create a end device light bulb.
18+
* The example demonstrates how to use Zigbee library to create an end device with
19+
* color dimmable light end point.
1920
* The light bulb is a Zigbee end device, which is controlled by a Zigbee coordinator.
2021
*
2122
* Proper Zigbee mode must be selected in Tools->Zigbee mode
@@ -33,11 +34,6 @@
3334
#include "Zigbee_core.h"
3435
#include "ep/ep_color_dimmable_light.h"
3536

36-
#include "esp_zigbee_core.h"
37-
#include "freertos/FreeRTOS.h"
38-
#include "freertos/task.h"
39-
#include "ha/esp_zigbee_ha_standard.h"
40-
4137
#define LED_PIN RGB_BUILTIN
4238
#define BUTTON_PIN 9 // C6/H2 Boot button
4339
#define ZIGBEE_LIGHT_ENDPOINT 10 /* esp light bulb device endpoint, used to process light controlling commands */
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"targets": {
3+
"esp32": false,
4+
"esp32c3": false,
5+
"esp32s2": false,
6+
"esp32s3": false
7+
},
8+
"fqbn": {
9+
"esp32c6": [
10+
"espressif:esp32:esp32c6:PartitionScheme=zigbee,ZigbeeMode=ed"
11+
],
12+
"esp32h2": [
13+
"espressif:esp32:esp32h2:PartitionScheme=zigbee,ZigbeeMode=ed"
14+
]
15+
}
16+
}

libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/README.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Arduino-ESP32 Zigbee Light Switch Example
1+
# Arduino-ESP32 Zigbee Color Dimmer Switch Example
22

3-
This example shows how to configure Zigbee Coordinator and use it as a Home Automation (HA) on/off light switch.
4-
5-
**This example is based on ESP-Zigbee-SDK example esp_zigbee_HA_sample/HA_on_off_switch.**
3+
This example shows how to configure Zigbee Coordinator and use it as a Home Automation (HA) color dimmer light switch.
64

75
# Supported Targets
86

@@ -13,13 +11,13 @@ Currently, this example supports the following targets.
1311

1412
## Hardware Required
1513

16-
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee end device (loaded with Zigbee_Light_bulb example).
14+
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee end device (loaded with Zigbee_Color_Dimmable_Light example).
1715
* A USB cable for power supply and programming.
18-
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee coordinator (loaded with Zigbee_Light_switch example).
16+
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee coordinator and upload the Zigbee_Color_Dimmable_Light example.
1917

2018
### Configure the Project
2119

22-
Set the Button Switch GPIO by changing the `GPIO_INPUT_IO_TOGGLE_SWITCH` definition. By default, the LED_PIN is `GPIO_NUM_9`.
20+
Set the Button Switch GPIO by changing the `GPIO_SWITCH` definition. By default, it's the pin `9` (BOOT button on ESP32-C6 and ESP32-H2).
2321

2422
#### Using Arduino IDE
2523

@@ -60,14 +58,8 @@ Before creating a new issue, be sure to try Troubleshooting and check if the sam
6058

6159
## Resources
6260

63-
The ESP Zigbee SDK provides more examples:
64-
* ESP Zigbee SDK Docs: [Link](https://docs.espressif.com/projects/esp-zigbee-sdk)
65-
* ESP Zigbee SDK Repo: [Link](https://github.com/espressif/esp-zigbee-sdk)
66-
6761
* Official ESP32 Forum: [Link](https://esp32.com)
6862
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
69-
* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf)
70-
* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf)
71-
* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf)
72-
* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf)
63+
* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf)
64+
* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf)
7365
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)

libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/Zigbee_Color_Dimmer_Switch.ino

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@
1313
// limitations under the License.
1414

1515
/**
16-
* @brief This example demonstrates simple Zigbee light switch.
16+
* @brief This example demonstrates Zigbee color dimmer switch.
1717
*
18-
* The example demonstrates how to use ESP Zigbee stack to control a light bulb.
19-
* The light bulb is a Zigbee end device, which is controlled by a Zigbee coordinator (Switch).
20-
* Button switch and Zigbee runs in separate tasks.
18+
* The example demonstrates how to use Zigbee library to control a RGB light bulb.
19+
* The RGB light bulb is a Zigbee end device, which is controlled by a Zigbee coordinator (Switch).
20+
* To turn on/off the light, push the button on the switch.
21+
* To change the color or level of the light, send serial commands to the switch.
22+
*
23+
* By setting the switch to allow multiple binding, so it can bind to multiple lights.
24+
* Also every 30 seconds, all bound lights are printed to the serial console.
2125
*
2226
* Proper Zigbee mode must be selected in Tools->Zigbee mode
2327
* and also the correct partition scheme must be selected in Tools->Partition Scheme.
@@ -34,15 +38,9 @@
3438
#include "Zigbee_core.h"
3539
#include "ep/ep_color_dimmer_switch.h"
3640

37-
#include "esp_zigbee_core.h"
38-
#include "freertos/FreeRTOS.h"
39-
#include "freertos/task.h"
40-
#include "ha/esp_zigbee_ha_standard.h"
41-
42-
#define SWITCH_ENDPOINT_NUMBER 5
43-
4441
/* Switch configuration */
45-
#define GPIO_SWITCH GPIO_NUM_9 //Boot button for C6/H2
42+
#define SWITCH_PIN 9 //Boot button for C6/H2
43+
#define SWITCH_ENDPOINT_NUMBER 5
4644

4745
/* Zigbee switch */
4846
ZigbeeColorDimmerSwitch zbSwitch = ZigbeeColorDimmerSwitch(SWITCH_ENDPOINT_NUMBER);
@@ -52,8 +50,8 @@ void setup() {
5250

5351
Serial.begin(115200);
5452

55-
// Init button switch
56-
pinMode(GPIO_SWITCH, INPUT);
53+
//Init button switch
54+
pinMode(SWITCH_PIN, INPUT);
5755

5856
//Optional: set Zigbee device name and model
5957
zbSwitch.setManufacturerAndModel("Espressif", "ZigbeeSwitch");
@@ -67,7 +65,7 @@ void setup() {
6765
//Open network for 180 seconds after boot
6866
Zigbee.setRebootOpenNetwork(180);
6967

70-
// When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode
68+
//When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode
7169
Zigbee.begin(ZIGBEE_COORDINATOR);
7270

7371
Serial.println("Waiting for Light to bound to the switch");
@@ -82,10 +80,9 @@ void setup() {
8280

8381
void loop() {
8482
// Handle button switch in loop()
85-
if (digitalRead(GPIO_SWITCH) == LOW) { // Push button pressed
86-
83+
if (digitalRead(SWITCH_PIN) == LOW) { // Push button pressed
8784
// Key debounce handling
88-
while (digitalRead(GPIO_SWITCH) == LOW) {
85+
while (digitalRead(SWITCH_PIN) == LOW) {
8986
delay(50);
9087
}
9188
// Toggle light
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"targets": {
3+
"esp32": false,
4+
"esp32c3": false,
5+
"esp32s2": false,
6+
"esp32s3": false
7+
},
8+
"fqbn": {
9+
"esp32c6": [
10+
"espressif:esp32:esp32c6:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr"
11+
],
12+
"esp32h2": [
13+
"espressif:esp32:esp32h2:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr"
14+
]
15+
}
16+
}

libraries/Zigbee/examples/Zigbee_On_Off_Light/README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Arduino-ESP32 Zigbee Light Bulb Example
1+
# Arduino-ESP32 Zigbee On/Off Light Example
22

3-
This example shows how to configure the Zigbee end device and use it as a Home Automation (HA) on/off light bulb.
4-
5-
**This example is based on ESP-Zigbee-SDK example esp_zigbee_HA_sample/HA_on_off_light.**
3+
This example shows how to configure the Zigbee end device and use it as a Home Automation (HA) on/off light.
64

75
# Supported Targets
86

@@ -13,9 +11,9 @@ Currently, this example supports the following targets.
1311

1412
## Hardware Required
1513

16-
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee coordinator (loaded with Zigbee_Light_switch example)
14+
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee coordinator (loaded with Zigbee_On_Off_switch example)
1715
* A USB cable for power supply and programming
18-
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee end device (loaded with Zigbee_Light_bulb example)
16+
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee end device and upload the Zigbee_On_Off_Light example
1917

2018
### Configure the Project
2119

@@ -60,14 +58,8 @@ Before creating a new issue, be sure to try Troubleshooting and check if the sam
6058

6159
## Resources
6260

63-
The ESP Zigbee SDK provides more examples:
64-
* ESP Zigbee SDK Docs: [Link](https://docs.espressif.com/projects/esp-zigbee-sdk)
65-
* ESP Zigbee SDK Repo: [Link](https://github.com/espressif/esp-zigbee-sdk)
66-
6761
* Official ESP32 Forum: [Link](https://esp32.com)
6862
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
69-
* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf)
70-
* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf)
71-
* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf)
72-
* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf)
63+
* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf)
64+
* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf)
7365
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)

libraries/Zigbee/examples/Zigbee_On_Off_Light/Zigbee_On_Off_Light.ino

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* @brief This example demonstrates simple Zigbee light bulb.
1717
*
18-
* The example demonstrates how to use ESP Zigbee stack to create a end device light bulb.
18+
* The example demonstrates how to use Zigbee library to create a end device light bulb.
1919
* The light bulb is a Zigbee end device, which is controlled by a Zigbee coordinator.
2020
*
2121
* Proper Zigbee mode must be selected in Tools->Zigbee mode
@@ -33,14 +33,9 @@
3333
#include "Zigbee_core.h"
3434
#include "ep/ep_on_off_light.h"
3535

36-
#include "esp_zigbee_core.h"
37-
#include "freertos/FreeRTOS.h"
38-
#include "freertos/task.h"
39-
#include "ha/esp_zigbee_ha_standard.h"
40-
4136
#define LED_PIN RGB_BUILTIN
4237
#define BUTTON_PIN 9 // C6/H2 Boot button
43-
#define ZIGBEE_LIGHT_ENDPOINT 10 /* esp light bulb device endpoint, used to process light controlling commands */
38+
#define ZIGBEE_LIGHT_ENDPOINT 10 /* esp light bulb device endpoint, used to process light controlling commands */
4439

4540
class MyZigbeeLight : public ZigbeeLight {
4641
public:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"targets": {
3+
"esp32": false,
4+
"esp32c3": false,
5+
"esp32s2": false,
6+
"esp32s3": false
7+
},
8+
"fqbn": {
9+
"esp32c6": [
10+
"espressif:esp32:esp32c6:PartitionScheme=zigbee,ZigbeeMode=ed"
11+
],
12+
"esp32h2": [
13+
"espressif:esp32:esp32h2:PartitionScheme=zigbee,ZigbeeMode=ed"
14+
]
15+
}
16+
}

libraries/Zigbee/examples/Zigbee_On_Off_Switch/README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# Arduino-ESP32 Zigbee Light Switch Example
1+
# Arduino-ESP32 Zigbee On/Off Light Switch Example
22

33
This example shows how to configure Zigbee Coordinator and use it as a Home Automation (HA) on/off light switch.
44

5-
**This example is based on ESP-Zigbee-SDK example esp_zigbee_HA_sample/HA_on_off_switch.**
6-
75
# Supported Targets
86

97
Currently, this example supports the following targets.
@@ -13,9 +11,9 @@ Currently, this example supports the following targets.
1311

1412
## Hardware Required
1513

16-
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee end device (loaded with Zigbee_Light_bulb example).
14+
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee end device (loaded with Zigbee_On_Off_Light example).
1715
* A USB cable for power supply and programming.
18-
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee coordinator (loaded with Zigbee_Light_switch example).
16+
* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee coordinator and upload the Zigbee_On_Off_Switch example.
1917

2018
### Configure the Project
2119

@@ -60,14 +58,8 @@ Before creating a new issue, be sure to try Troubleshooting and check if the sam
6058

6159
## Resources
6260

63-
The ESP Zigbee SDK provides more examples:
64-
* ESP Zigbee SDK Docs: [Link](https://docs.espressif.com/projects/esp-zigbee-sdk)
65-
* ESP Zigbee SDK Repo: [Link](https://github.com/espressif/esp-zigbee-sdk)
66-
6761
* Official ESP32 Forum: [Link](https://esp32.com)
6862
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
69-
* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf)
70-
* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf)
71-
* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf)
72-
* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf)
63+
* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf)
64+
* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf)
7365
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)

0 commit comments

Comments
 (0)