Skip to content

Commit 3b7c3a8

Browse files
authored
fix(zigbee): fix power outlet compile errors and update example
1 parent 8f71c44 commit 3b7c3a8

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

libraries/Zigbee/examples/Zigbee_Power_Outlet/Zigbee_Power_Outlet.ino

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,19 @@
2626
* Created by Ludovic Boué (https://github.com/lboue)
2727
*/
2828

29-
#ifndef ZIGBEE_MODE_ED
30-
#error "Zigbee end device mode is not selected in Tools->Zigbee mode"
29+
#ifndef ZIGBEE_MODE_ZCZR
30+
#error "Zigbee router mode is not selected in Tools->Zigbee mode"
3131
#endif
3232

3333
#include "Zigbee.h"
3434

3535
/* Zigbee power outlet configuration */
36-
#define ZIGBEE_OUTLET_ENDPOINT 10
36+
#define ZIGBEE_OUTLET_ENDPOINT 1
3737
uint8_t led = RGB_BUILTIN;
3838
uint8_t button = BOOT_PIN;
3939

4040
ZigbeePowerOutlet zbOutlet = ZigbeePowerOutlet(ZIGBEE_OUTLET_ENDPOINT);
4141

42-
43-
4442
/********************* RGB LED functions **************************/
4543
void setLED(bool value) {
4644
digitalWrite(led, value);
@@ -68,7 +66,7 @@ void setup() {
6866
Zigbee.addEndpoint(&zbOutlet);
6967

7068
// When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE
71-
if (!Zigbee.begin()) {
69+
if (!Zigbee.begin(ZIGBEE_ROUTER)) {
7270
Serial.println("Zigbee failed to start!");
7371
Serial.println("Rebooting...");
7472
ESP.restart();

libraries/Zigbee/src/ep/ZigbeePowerOutlet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ZigbeePowerOutlet::ZigbeePowerOutlet(uint8_t endpoint) : ZigbeeEP(endpoint) {
55
_device_id = ESP_ZB_HA_MAINS_POWER_OUTLET_DEVICE_ID;
66

7-
esp_zb_mains_power_outlet_cfg_t outlet_cfg = ESP_ZB_DEFAULT_ON_OFF_SWITCH_CONFIG();
7+
esp_zb_mains_power_outlet_cfg_t outlet_cfg = ESP_ZB_DEFAULT_MAINS_POWER_OUTLET_CONFIG();
88
_cluster_list = esp_zb_mains_power_outlet_clusters_create(&outlet_cfg);
99
_ep_config = {.endpoint = endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_MAINS_POWER_OUTLET_DEVICE_ID, .app_device_version = 0};
1010
log_v("Outlet endpoint created %d", _endpoint);

0 commit comments

Comments
 (0)