Skip to content

Commit 04e0f75

Browse files
committed
Update READMEs + add openNetwork fucntion
1 parent 27ecf23 commit 04e0f75

File tree

12 files changed

+62
-45
lines changed

12 files changed

+62
-45
lines changed

libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,21 @@ To get more information about the Espressif boards see [Espressif Development Ki
2727
* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)`
2828
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`
2929
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
30+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
3031

3132
## Troubleshooting
3233

33-
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.
34+
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.
3435
You can do the following:
3536

36-
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`
37-
* In the sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
37+
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
38+
* Add to the sketch `Zigbee.factoryReset();` to reset the device and Zigbee stack.
3839

39-
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.
40-
You can change it by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
40+
By default, the coordinator network is closed after rebooting or flashing new firmware.
41+
To open the network you have 2 options:
42+
43+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
44+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
4145

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

libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,21 @@ To get more information about the Espressif boards see [Espressif Development Ki
2727
* Select the Coordinator Zigbee mode: `Tools -> Zigbee mode: Zigbee ZCZR (coordinator/router)`.
2828
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`.
2929
* Select the COM port: `Tools -> Port: xxx where the `xxx` is the detected COM port.
30-
* Optional: Set debug level to info to see logs from Zigbee stack: `Tools -> Core Debug Level: Info`.
30+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
3131

3232
## Troubleshooting
3333

34-
If the End device flashed with the example `Zigbee_Light_Bulb` 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.
34+
If the End device flashed with the example `Zigbee_Color_Dimmable_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.
3535
You can do the following:
3636

3737
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
38-
* In the `Zigbee_Light_Bulb` example sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
38+
* Add to the sketch `Zigbee.factoryReset();` to reset the device and Zigbee stack.
3939

40-
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.
41-
You can change it by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
40+
By default, the coordinator network is closed after rebooting or flashing new firmware.
41+
To open the network you have 2 options:
42+
43+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
44+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
4245

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

libraries/Zigbee/examples/Zigbee_On_Off_Light/README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,22 @@ To get more information about the Espressif boards see [Espressif Development Ki
2828
* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)`
2929
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`
3030
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
31+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
3132

3233
## Troubleshooting
3334

34-
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.
35+
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.
3536
You can do the following:
3637

37-
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`
38-
* In the sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
38+
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
39+
* Add to the sketch `Zigbee.factoryReset();` to reset the device and Zigbee stack.
40+
41+
By default, the coordinator network is closed after rebooting or flashing new firmware.
42+
To open the network you have 2 options:
43+
44+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
45+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
3946

40-
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.
41-
You can change it by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
4247

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

libraries/Zigbee/examples/Zigbee_On_Off_Switch/README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,21 @@ To get more information about the Espressif boards see [Espressif Development Ki
2727
* Select the Coordinator Zigbee mode: `Tools -> Zigbee mode: Zigbee ZCZR (coordinator/router)`.
2828
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`.
2929
* Select the COM port: `Tools -> Port: xxx where the `xxx` is the detected COM port.
30-
* Optional: Set debug level to info to see logs from Zigbee stack: `Tools -> Core Debug Level: Info`.
30+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
3131

3232
## Troubleshooting
3333

34-
If the End device flashed with the example `Zigbee_Light_Bulb` 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.
34+
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.
3535
You can do the following:
3636

3737
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
38-
* In the `Zigbee_Light_Bulb` example sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
38+
* In the `Zigbee_On_Off_Light` example sketch call `Zigbee.factoryReset();`.
3939

40-
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.
41-
You can change it by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
40+
By default, the coordinator network is closed after rebooting or flashing new firmware.
41+
To open the network you have 2 options:
42+
43+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
44+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
4245

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

libraries/Zigbee/examples/Zigbee_Scan_Networks/README.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,10 @@ To get more information about the Espressif boards see [Espressif Development Ki
4242
* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)`
4343
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`
4444
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
45+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
4546

4647
## Troubleshooting
4748

48-
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.
49-
You can do the following:
50-
51-
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`
52-
* In the sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
53-
54-
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.
55-
You can change it by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
56-
5749
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
5850

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

libraries/Zigbee/examples/Zigbee_Temperature_Sensor/README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,21 @@ To get more information about the Espressif boards see [Espressif Development Ki
3838
* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)`
3939
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`
4040
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
41+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
4142

4243
## Troubleshooting
4344

44-
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.
45+
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.
4546
You can do the following:
4647

47-
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`
48-
* In the sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
48+
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
49+
* Add to the sketch `Zigbee.factoryReset();` to reset the device and Zigbee stack.
4950

50-
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.
51-
You can change it by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
51+
By default, the coordinator network is closed after rebooting or flashing new firmware.
52+
To open the network you have 2 options:
53+
54+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
55+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
5256

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

libraries/Zigbee/examples/Zigbee_Thermostat/README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,21 @@ To get more information about the Espressif boards see [Espressif Development Ki
3838
* Select the Coordinator Zigbee mode: `Tools -> Zigbee mode: Zigbee ZCZR (coordinator/router)`.
3939
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`.
4040
* Select the COM port: `Tools -> Port: xxx where the `xxx` is the detected COM port.
41-
* Optional: Set debug level to info to see logs from Zigbee stack: `Tools -> Core Debug Level: Info`.
41+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
4242

4343
## Troubleshooting
4444

4545
If the End device flashed with the example `Zigbee_Temperature_Sensor` 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.
4646
You can do the following:
4747

4848
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
49-
* In the `Zigbee_Temperature_Sensor` example sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function.
49+
* In the `Zigbee_Temperature_Sensor` example sketch call `Zigbee.factoryReset();`.
5050

51-
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.
52-
You can change it by editing `esp_zb_bdb_open_network(180);` in `esp_zb_app_signal_handler` function.
51+
By default, the coordinator network is closed after rebooting or flashing new firmware.
52+
To open the network you have 2 options:
53+
54+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
55+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
5356

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

libraries/Zigbee/src/ZigbeeCore.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ void ZigbeeCore::setRebootOpenNetwork(uint8_t time) {
154154
_open_network = time;
155155
}
156156

157+
void ZigbeeCore::openNetwork(uint8_t time) {
158+
if (_started) {
159+
log_v("Openning network for joining for %d seconds", time);
160+
esp_zb_bdb_open_network(time);
161+
}
162+
}
163+
157164
static void bdb_start_top_level_commissioning_cb(uint8_t mode_mask) {
158165
ESP_ERROR_CHECK(esp_zb_bdb_start_top_level_commissioning(mode_mask));
159166
}

libraries/Zigbee/src/ZigbeeCore.h

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class ZigbeeCore {
107107

108108
void setPrimaryChannelMask(uint32_t mask);
109109
void setRebootOpenNetwork(uint8_t time);
110+
void openNetwork(uint8_t time);
110111

111112
//scan_duration Time spent scanning each channel, in units of ((1 << scan_duration) + 1) * a beacon time. (15.36 microseconds)
112113
void scanNetworks(uint32_t channel_mask = ESP_ZB_TRANSCEIVER_ALL_CHANNELS_MASK, uint8_t scan_duration = 5);

libraries/Zigbee/src/ZigbeeEP.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ char* ZigbeeEP::readModel(uint8_t endpoint, uint16_t short_addr) {
124124
return _read_model;
125125
}
126126

127-
#pragma GCC diagnostic push
128-
#pragma GCC diagnostic ignored "-Wunused-variable"
129-
130127
void ZigbeeEP::printBoundDevices() {
131128
log_i("Bound devices:");
132129
for(const auto& device : _bound_devices) {
@@ -135,8 +132,6 @@ void ZigbeeEP::printBoundDevices() {
135132
}
136133
}
137134

138-
#pragma GCC diagnostic pop
139-
140135
void ZigbeeEP::zbReadBasicCluster(const esp_zb_zcl_attribute_t *attribute) {
141136
/* Basic cluster attributes */
142137
if (attribute->id == ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID && attribute->data.type == ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING && attribute->data.value) {

libraries/Zigbee/src/ep/ZigbeeLight.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ void ZigbeeLight::lightChanged() {
3939
}
4040
}
4141

42-
#endif //SOC_IEEE802154_SUPPORTED
42+
#endif //SOC_IEEE802154_SUPPORTED

libraries/Zigbee/src/ep/ZigbeeSwitch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,4 @@ void ZigbeeSwitch::lightOnWithTimedOff(uint8_t on_off_control, uint16_t time_on,
235235
}
236236
}
237237

238-
#endif //SOC_IEEE802154_SUPPORTED
238+
#endif //SOC_IEEE802154_SUPPORTED

0 commit comments

Comments
 (0)