Skip to content

Commit decf71b

Browse files
authored
Merge branch 'master' into feat/zigbee-input-output-clusters
2 parents 66bfbce + 542274d commit decf71b

File tree

30 files changed

+2088
-264
lines changed

30 files changed

+2088
-264
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ set(ARDUINO_LIBRARY_Zigbee_SRCS
302302
libraries/Zigbee/src/ep/ZigbeeIlluminanceSensor.cpp
303303
libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp
304304
libraries/Zigbee/src/ep/ZigbeeBinary.cpp
305+
libraries/Zigbee/src/ep/ZigbeePowerOutlet.cpp
305306
)
306307

307308
set(ARDUINO_LIBRARY_BLE_SRCS

boards.txt

Lines changed: 741 additions & 95 deletions
Large diffs are not rendered by default.

cores/esp32/esp32-hal-i2c-slave.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,12 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
335335
}
336336
#endif // !defined(CONFIG_IDF_TARGET_ESP32P4)
337337

338-
i2c_ll_slave_init(i2c->dev);
339338
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
339+
i2c_ll_set_mode(i2c->dev, I2C_BUS_MODE_SLAVE);
340+
i2c_ll_enable_pins_open_drain(i2c->dev, true);
340341
i2c_ll_enable_fifo_mode(i2c->dev, true);
341342
#else
343+
i2c_ll_slave_init(i2c->dev);
342344
i2c_ll_slave_set_fifo_mode(i2c->dev, true);
343345
#endif
344346
i2c_ll_set_slave_addr(i2c->dev, slaveID, false);

libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ static esp_err_t status_handler(httpd_req_t *req) {
478478
p += sprintf(p, "\"raw_gma\":%u,", s->status.raw_gma);
479479
p += sprintf(p, "\"lenc\":%u,", s->status.lenc);
480480
p += sprintf(p, "\"hmirror\":%u,", s->status.hmirror);
481+
p += sprintf(p, "\"vflip\":%u,", s->status.vflip);
481482
p += sprintf(p, "\"dcw\":%u,", s->status.dcw);
482483
p += sprintf(p, "\"colorbar\":%u", s->status.colorbar);
483484
#if CONFIG_LED_ILLUMINATOR_ENABLED
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Arduino-ESP32 Zigbee Multi-Switch Example
2+
3+
This example demonstrates how to configure a Zigbee device as a multi-switch controller that can control up to three different Zigbee lights independently. The switch can operate in either coordinator or router mode, making it compatible with Home Assistant integration.
4+
5+
# Supported Targets
6+
7+
Currently, this example supports the following targets.
8+
9+
| Supported Targets | ESP32-C6 | ESP32-H2 |
10+
| ----------------- | -------- | -------- |
11+
12+
## Hardware Required
13+
14+
* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee multi-switch controller
15+
* One or more Zigbee light devices (loaded with Zigbee_On_Off_Light example)
16+
* A USB cable for power supply and programming
17+
18+
### Configure the Project
19+
20+
The example uses the BOOT button (pin 9) on ESP32-C6 and ESP32-H2 as the physical switch input. The switch can be configured to operate in two modes:
21+
22+
1. **Coordinator Mode**: For running your own Zigbee network
23+
2. **Router Mode**: For Home Assistant integration
24+
25+
#### Using Arduino IDE
26+
27+
To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits).
28+
29+
* Before Compile/Verify, select the correct board: `Tools -> Board`
30+
* Select the Zigbee mode: `Tools -> Zigbee mode: Zigbee ZCZR (coordinator/router)`
31+
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`
32+
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port
33+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`
34+
35+
## Features
36+
37+
The multi-switch example provides the following functionality:
38+
39+
1. **Light Configuration**
40+
- Configure up to 3 different lights using their endpoint and IEEE address
41+
- Configuration is stored in NVS (Non-Volatile Storage) and persists after power loss
42+
- Remove configured lights when needed
43+
44+
2. **Control Commands**
45+
- Control all bound lights simultaneously:
46+
- Turn all bound lights ON
47+
- Turn all bound lights OFF
48+
- Toggle all bound lights
49+
- Control individual lights (1-3):
50+
- Turn light ON
51+
- Turn light OFF
52+
- Toggle light
53+
54+
3. **Network Management**
55+
- Factory reset capability
56+
- Open network for device joining
57+
- View bound devices and current light configurations
58+
59+
## Serial Commands
60+
61+
The example accepts the following commands through the serial interface:
62+
63+
* `config` - Configure a new light (requires light number, endpoint, and IEEE address)
64+
* `remove` - Remove a configured light
65+
* `on` - Turn all bound lights ON
66+
* `off` - Turn all bound lights OFF
67+
* `toggle` - Toggle all bound lights
68+
* `1on`, `2on`, `3on` - Turn individual light ON
69+
* `1off`, `2off`, `3off` - Turn individual light OFF
70+
* `1toggle`, `2toggle`, `3toggle` - Toggle individual light
71+
* `freset` - Perform factory reset
72+
* `open_network` - Open network for device joining (only for coordinator role)
73+
74+
## Troubleshooting
75+
76+
If the End device flashed with the example `Zigbee_On_Off_Light` 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.
77+
You can do the following:
78+
79+
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`
80+
* In the `Zigbee_On_Off_Light` example sketch call `Zigbee.factoryReset()`
81+
82+
By default, the coordinator network is closed after rebooting or flashing new firmware.
83+
To open the network you have 2 options:
84+
85+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time)` before calling `Zigbee.begin()`
86+
* In application you can anytime call `Zigbee.openNetwork(time)` to open the network for devices to join
87+
88+
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
89+
90+
* **LED not blinking:** Check the wiring connection and the IO selection
91+
* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed
92+
* **COM port not detected:** Check the USB cable and the USB to Serial driver installation
93+
94+
If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute).
95+
96+
## Contribute
97+
98+
To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst)
99+
100+
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!
101+
102+
Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else.
103+
104+
## Resources
105+
106+
* Official ESP32 Forum: [Link](https://esp32.com)
107+
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
108+
* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf)
109+
* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf)
110+
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)

0 commit comments

Comments
 (0)