mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
Zigbee: Merging light_coordinator and light switch into one
* Light bulb acting as ZED and bulb server device * Light switch acting as ZC and switch client device * ZC stay starting network steering to permit device join
This commit is contained in:

committed by
BOT

parent
d178d1d58a
commit
c42628fd4f
@@ -24,6 +24,7 @@ The examples are grouped into subdirectories by category. Each category director
|
|||||||
- `storage` Examples showing data storage methods using SPI flash, external storage like the SD/MMC interface and flash partitioning.
|
- `storage` Examples showing data storage methods using SPI flash, external storage like the SD/MMC interface and flash partitioning.
|
||||||
- `system` Demonstrates some internal chip features, or debugging & development tools.
|
- `system` Demonstrates some internal chip features, or debugging & development tools.
|
||||||
- `wifi` Advanced Wi-Fi features (For network protocol examples, see `protocols` instead.)
|
- `wifi` Advanced Wi-Fi features (For network protocol examples, see `protocols` instead.)
|
||||||
|
- `Zigbee` Zigbee network and device examples.
|
||||||
|
|
||||||
In addition to these examples, `commmon_components` directory contains code shared by several examples.
|
In addition to these examples, `commmon_components` directory contains code shared by several examples.
|
||||||
|
|
||||||
|
@@ -4,11 +4,9 @@
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
The folder contains examples demonstrating Zigbee Router, Coordinator, and End-Device roles
|
The folder contains examples demonstrating Zigbee Coordinator and End-Device roles
|
||||||
|
|
||||||
* [light_bulb](light_bulb) is a light bulb example demonstrating Zigbee Router role. It provides a simple on/off condition for a Zigbee light. It runs on an 802.15.4 SoC like ESP32-H2. For more details see the example readme file.
|
* [light_bulb](light_bulb) is a light bulb example demonstrating Zigbee End-Device role. It provides a simple on/off condition for a Zigbee light. It runs on an 802.15.4 SoC like ESP32-H2. For more details see the example readme file.
|
||||||
|
|
||||||
* [light_coordinator](light_coordinator) is a light coordinator example demonstrating Zigbee Coordinator role. It provides a formation of the Zigbee network. It runs on an 802.15.4 SoC like ESP32-H2. For more details to see the example readme file.
|
* [light_switch](light_switch) is a light switch example demonstrating Zigbee Coordinator role. It provides an on/off toggle to control light. It runs on an 802.15.4 SoC like ESP32-H2. For more details to see the example readme file.
|
||||||
|
|
||||||
* [light_switch](light_switch) is a light switch example demonstrating Zigbee End-Device role. It provides an on/off toggle to control light. It runs on an 802.15.4 SoC like ESP32-H2. For more details to see the example readme file.
|
|
||||||
|
|
||||||
|
@@ -5,14 +5,13 @@
|
|||||||
|
|
||||||
(See the `README.md` file in the upper level 'examples' directory for more information about examples.)
|
(See the `README.md` file in the upper level 'examples' directory for more information about examples.)
|
||||||
|
|
||||||
This test code shows how to configure Zigbee router device and use it as a light bulb
|
This test code shows how to configure Zigbee end device and use it as a light bulb
|
||||||
|
|
||||||
## Hardware Required
|
## Hardware Required
|
||||||
|
|
||||||
* One development board with ESP32-H2 SoC acting as Zigbee router (loaded with light bulb example)
|
* One development board with ESP32-H2 SoC acting as Zigbee end device (loaded with light bulb example)
|
||||||
* A USB cable for power supply and programming
|
* A USB cable for power supply and programming
|
||||||
* Choose another ESP32-H2 as Zigbee coordinator (see [light coordinator example](../light_coordinator))
|
* Choose another ESP32-H2 as Zigbee coordinator (see [light switch example](../light_switch))
|
||||||
* Choose another ESP32-H2 as Zigbee end-device (see [light switch example](../light_switch))
|
|
||||||
|
|
||||||
## Configure the project
|
## Configure the project
|
||||||
|
|
||||||
@@ -29,17 +28,16 @@ Build the project, flash it to the board, and start the monitor tool to view the
|
|||||||
As you run the example, you will see the following log:
|
As you run the example, you will see the following log:
|
||||||
|
|
||||||
light bulb:
|
light bulb:
|
||||||
I (9638) ESP_ZB_LIGHT: status: 255
|
I (918) ESP_ZB_LIGHT: status: 255
|
||||||
I (9638) ESP_ZB_LIGHT: Zigbee stack initialized
|
I (901) ESP_ZB_LIGHT: Zigbee stack initialized
|
||||||
I (9648) ESP_ZB_LIGHT: Start network steering
|
I (901) ESP_ZB_LIGHT: Start network steering
|
||||||
I (12368) ESP_ZB_LIGHT: Joined network successfully (Extended PAN ID: f9:54:2d:01:a0:03:f7:84, PAN ID: 0xf5b5)
|
I (2611) ESP_ZB_LIGHT: Joined network successfully (Extended PAN ID: aa:98:48:01:a0:03:f7:84, PAN ID: 0x0e8b)
|
||||||
I (12398) ESP_ZB_LIGHT: status: 0
|
I (5651) ESP_ZB_LIGHT: on/off attribute setting to 1
|
||||||
I (18158) ESP_ZB_LIGHT: on/off attribute setting to 1
|
I (6631) ESP_ZB_LIGHT: on/off attribute setting to 0
|
||||||
I (19388) ESP_ZB_LIGHT: on/off attribute setting to 0
|
I (7331) ESP_ZB_LIGHT: on/off attribute setting to 1
|
||||||
I (20418) ESP_ZB_LIGHT: on/off attribute setting to 1
|
I (8251) ESP_ZB_LIGHT: on/off attribute setting to 0
|
||||||
I (21558) ESP_ZB_LIGHT: on/off attribute setting to 0
|
I (9111) ESP_ZB_LIGHT: on/off attribute setting to 1
|
||||||
I (22478) ESP_ZB_LIGHT: on/off attribute setting to 1
|
I (9671) ESP_ZB_LIGHT: on/off attribute setting to 0
|
||||||
I (23088) ESP_ZB_LIGHT: on/off attribute setting to 0
|
|
||||||
|
|
||||||
## Light Control Functions
|
## Light Control Functions
|
||||||
|
|
||||||
|
@@ -36,8 +36,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
#include "esp_zb_light.h"
|
#include "esp_zb_light.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @note Make sure set idf.py menuconfig in zigbee component as zigbee end-device device!
|
||||||
|
*/
|
||||||
|
#if !defined ZB_ED_ROLE
|
||||||
|
#error Define ZB_ED_ROLE in idf.py menuconfig to compile light bulb source code.
|
||||||
|
#endif
|
||||||
|
|
||||||
static bulb_device_ctx_t esp_light_ctx = {
|
static bulb_device_ctx_t esp_light_ctx = {
|
||||||
/* basic cluster attributes data */
|
/* basic cluster attributes data */
|
||||||
.basic_attr.zcl_version = ZB_ZCL_VERSION,
|
.basic_attr.zcl_version = ZB_ZCL_VERSION,
|
||||||
@@ -108,8 +117,9 @@ static void bdb_start_top_level_commissioning_cb(zb_uint8_t mode_mask)
|
|||||||
*/
|
*/
|
||||||
void zboss_signal_handler(zb_bufid_t bufid)
|
void zboss_signal_handler(zb_bufid_t bufid)
|
||||||
{
|
{
|
||||||
zb_uint8_t status = ZB_GET_APP_SIGNAL_STATUS(bufid);
|
zb_zdo_app_signal_hdr_t *p_sg_p = NULL;
|
||||||
zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, NULL);
|
zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &p_sg_p);
|
||||||
|
zb_ret_t status = ZB_GET_APP_SIGNAL_STATUS(bufid);
|
||||||
|
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case ZB_ZDO_SIGNAL_SKIP_STARTUP:
|
case ZB_ZDO_SIGNAL_SKIP_STARTUP:
|
||||||
@@ -212,20 +222,13 @@ static void esp_zb_light_cb(zb_bufid_t bufid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main(void)
|
static void zboss_task(void *pvParameters)
|
||||||
{
|
{
|
||||||
zb_ret_t zb_err_code;
|
|
||||||
zb_esp_platform_config_t config = {
|
|
||||||
.radio_config = ZB_ESP_DEFAULT_RADIO_CONFIG(),
|
|
||||||
.host_config = ZB_ESP_DEFAULT_HOST_CONFIG(),
|
|
||||||
};
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(zb_esp_platform_config(&config));
|
|
||||||
/* initialize Zigbee stack */
|
/* initialize Zigbee stack */
|
||||||
ZB_INIT("light_bulb");
|
ZB_INIT("light_bulb");
|
||||||
zb_set_network_router_role(IEEE_CHANNEL_MASK);
|
zb_set_network_ed_role(IEEE_CHANNEL_MASK);
|
||||||
zb_set_max_children(MAX_CHILDREN);
|
|
||||||
zb_set_nvram_erase_at_start(ERASE_PERSISTENT_CONFIG);
|
zb_set_nvram_erase_at_start(ERASE_PERSISTENT_CONFIG);
|
||||||
|
zb_set_ed_timeout(ED_AGING_TIMEOUT_64MIN);
|
||||||
zb_set_keepalive_timeout(ZB_MILLISECONDS_TO_BEACON_INTERVAL(3000));
|
zb_set_keepalive_timeout(ZB_MILLISECONDS_TO_BEACON_INTERVAL(3000));
|
||||||
/* hardware related and device init */
|
/* hardware related and device init */
|
||||||
light_driver_init(LIGHT_DEFAULT_OFF);
|
light_driver_init(LIGHT_DEFAULT_OFF);
|
||||||
@@ -233,10 +236,19 @@ void app_main(void)
|
|||||||
ZB_ZCL_REGISTER_DEVICE_CB(esp_zb_light_cb);
|
ZB_ZCL_REGISTER_DEVICE_CB(esp_zb_light_cb);
|
||||||
/* register light device context (endpoints) */
|
/* register light device context (endpoints) */
|
||||||
ZB_AF_REGISTER_DEVICE_CTX(&esp_zb_light_ctx);
|
ZB_AF_REGISTER_DEVICE_CTX(&esp_zb_light_ctx);
|
||||||
zb_err_code = zboss_start_no_autostart();
|
ESP_ERROR_CHECK(zboss_start_no_autostart());
|
||||||
ESP_ERROR_CHECK(zb_err_code);
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
zboss_main_loop_iteration();
|
zboss_main_loop_iteration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void app_main(void)
|
||||||
|
{
|
||||||
|
zb_esp_platform_config_t config = {
|
||||||
|
.radio_config = ZB_ESP_DEFAULT_RADIO_CONFIG(),
|
||||||
|
.host_config = ZB_ESP_DEFAULT_HOST_CONFIG(),
|
||||||
|
};
|
||||||
|
/* load Zigbee light_bulb platform config to initialization */
|
||||||
|
ESP_ERROR_CHECK(zb_esp_platform_config(&config));
|
||||||
|
xTaskCreate(zboss_task, "zboss_main", 4096, NULL, 5, NULL);
|
||||||
|
}
|
||||||
|
@@ -41,7 +41,6 @@
|
|||||||
/* Zigbee configuration */
|
/* Zigbee configuration */
|
||||||
#define IEEE_CHANNEL_MASK (1l << 13) /* Zigbee default setting is channel 13 for light example usage */
|
#define IEEE_CHANNEL_MASK (1l << 13) /* Zigbee default setting is channel 13 for light example usage */
|
||||||
#define ERASE_PERSISTENT_CONFIG ZB_TRUE /* erase network devices before running example */
|
#define ERASE_PERSISTENT_CONFIG ZB_TRUE /* erase network devices before running example */
|
||||||
#define MAX_CHILDREN 10 /* the max amount of connected devices */
|
|
||||||
|
|
||||||
/* groups cluster attributes */
|
/* groups cluster attributes */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@@ -31,6 +31,6 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
|||||||
# Zboss
|
# Zboss
|
||||||
#
|
#
|
||||||
CONFIG_ZB_ENABLED=y
|
CONFIG_ZB_ENABLED=y
|
||||||
CONFIG_ZB_ZCZR=y
|
CONFIG_ZB_ZED=y
|
||||||
# end of Zboss
|
# end of Zboss
|
||||||
# end of Component config
|
# end of Component config
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
# The following lines of boilerplate have to be in your project's CMakeLists
|
|
||||||
# in this exact order for cmake to work correctly
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
||||||
project(light_coordinator)
|
|
@@ -1,53 +0,0 @@
|
|||||||
| Supported Targets | ESP32-H2 |
|
|
||||||
| ----------------- | -------- |
|
|
||||||
|
|
||||||
# Light Coordinator Example
|
|
||||||
|
|
||||||
(See the `README.md` file in the upper level 'examples' directory for more information about examples.)
|
|
||||||
|
|
||||||
This test code shows how to configure Zigbee coordinator device.
|
|
||||||
|
|
||||||
## Hardware Required
|
|
||||||
|
|
||||||
* One development board with ESP32-H2 SoC acting as Zigbee coordinator (loaded with light coordinator example)
|
|
||||||
* A USB cable for power supply and programming
|
|
||||||
* Choose another ESP32-H2 as Zigbee router (see [light bulb example](../light_bulb))
|
|
||||||
* Choose another ESP32-H2 as Zigbee end-device (see [light switch example](../light_switch))
|
|
||||||
|
|
||||||
## Configure the project
|
|
||||||
|
|
||||||
Before project configuration and build, make sure to set the correct chip target using `idf.py set-target esp32h2`.
|
|
||||||
|
|
||||||
## Build and Flash
|
|
||||||
|
|
||||||
Build the project, flash it to the board, and start the monitor tool to view the serial output by running `idf.py -p PORT flash monitor`.
|
|
||||||
|
|
||||||
(To exit the serial monitor, type ``Ctrl-]``.)
|
|
||||||
|
|
||||||
## Example Output
|
|
||||||
|
|
||||||
As you run the example, you will see the following log:
|
|
||||||
|
|
||||||
light coodrinator:
|
|
||||||
I (9556) ESP_ZB_COORDINATOR: status: -1
|
|
||||||
I (9556) ESP_ZB_COORDINATOR: Zigbee stack initialized
|
|
||||||
I (9556) ESP_ZB_COORDINATOR: Start network formation
|
|
||||||
I (10066) ESP_ZB_COORDINATOR: Joined network successfully (Extended PAN ID: f9:54:2d:01:a0:03:f7:84, PAN ID: 0xf5b5)
|
|
||||||
I (10526) ESP_ZB_COORDINATOR: Network steering started
|
|
||||||
I (11306) ESP_ZB_COORDINATOR: status: 0
|
|
||||||
I (11806) ESP_ZB_COORDINATOR: status: 0
|
|
||||||
I (11886) ESP_ZB_COORDINATOR: New device commissioned or rejoined (short: 0x434a)
|
|
||||||
I (12386) ESP_ZB_COORDINATOR: status: 0
|
|
||||||
I (12486) ESP_ZB_COORDINATOR: status: 0
|
|
||||||
I (12896) ESP_ZB_COORDINATOR: status: 0
|
|
||||||
I (12946) ESP_ZB_COORDINATOR: New device commissioned or rejoined (short: 0x09c2)
|
|
||||||
I (13516) ESP_ZB_COORDINATOR: status: 0
|
|
||||||
I (26686) ESP_ZB_COORDINATOR: status: 0
|
|
||||||
|
|
||||||
## Light Control Functions
|
|
||||||
|
|
||||||
* By toggling the switch button (BOOT) on the ESP32-H2 board loaded with `light switch` example, the LED on the board loaded with `light bulb` example will be on and off.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
|
|
@@ -1,2 +0,0 @@
|
|||||||
idf_component_register(SRCS "esp_zb_coordinator.c"
|
|
||||||
INCLUDE_DIRS ".")
|
|
@@ -1,136 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
|
||||||
* integrated circuit in a product or a software update for such product,
|
|
||||||
* must reproduce the above copyright notice, this list of conditions and
|
|
||||||
* the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* 4. Any software provided in binary form under this license must not be reverse
|
|
||||||
* engineered, decompiled, modified and/or disassembled.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "esp_err.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
#include "esp_zb_coordinator.h"
|
|
||||||
|
|
||||||
static const char *TAG = "ESP_ZB_COORDINATOR";
|
|
||||||
|
|
||||||
/********************* Define functions **************************/
|
|
||||||
static void bdb_start_top_level_commissioning_cb(zb_uint8_t mode_mask)
|
|
||||||
{
|
|
||||||
if (!bdb_start_top_level_commissioning(mode_mask)) {
|
|
||||||
ESP_LOGE(TAG, "In BDB commissioning, an error occurred (for example: the device has already been running)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Zigbee zboss stack event signal handler.
|
|
||||||
*
|
|
||||||
* @param bufid Zigbee zboss stack buffer id used to pass signal.
|
|
||||||
*/
|
|
||||||
void zboss_signal_handler(zb_bufid_t bufid)
|
|
||||||
{
|
|
||||||
/* Read signal description out of memory buffer. */
|
|
||||||
zb_zdo_app_signal_hdr_t *p_sg_p = NULL;
|
|
||||||
zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &p_sg_p);
|
|
||||||
zb_ret_t status = ZB_GET_APP_SIGNAL_STATUS(bufid);
|
|
||||||
zb_zdo_signal_device_annce_params_t *dev_annce_params = NULL;
|
|
||||||
|
|
||||||
switch (sig) {
|
|
||||||
case ZB_ZDO_SIGNAL_SKIP_STARTUP:
|
|
||||||
ESP_LOGI(TAG, "Zigbee stack initialized");
|
|
||||||
bdb_start_top_level_commissioning(ZB_BDB_INITIALIZATION);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZB_BDB_SIGNAL_DEVICE_FIRST_START:
|
|
||||||
if (status == RET_OK) {
|
|
||||||
ESP_LOGI(TAG, "Start network formation");
|
|
||||||
bdb_start_top_level_commissioning(ZB_BDB_NETWORK_FORMATION);
|
|
||||||
} else {
|
|
||||||
ESP_LOGE(TAG, "Failed to initialize Zigbee stack (status: %d)", status);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZB_BDB_SIGNAL_FORMATION:
|
|
||||||
if (status == RET_OK) {
|
|
||||||
zb_ext_pan_id_t extended_pan_id;
|
|
||||||
zb_get_extended_pan_id(extended_pan_id);
|
|
||||||
ESP_LOGI(TAG, "Joined network successfully (Extended PAN ID: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x, PAN ID: 0x%04hx)",
|
|
||||||
extended_pan_id[7], extended_pan_id[6], extended_pan_id[5], extended_pan_id[4],
|
|
||||||
extended_pan_id[3], extended_pan_id[2], extended_pan_id[1], extended_pan_id[0],
|
|
||||||
ZB_PIBCACHE_PAN_ID());
|
|
||||||
bdb_start_top_level_commissioning(ZB_BDB_NETWORK_STEERING);
|
|
||||||
} else {
|
|
||||||
ESP_LOGI(TAG, "Restart network formation (status: %d)", status);
|
|
||||||
ZB_SCHEDULE_APP_ALARM((zb_callback_t)bdb_start_top_level_commissioning_cb, ZB_BDB_NETWORK_FORMATION, ZB_TIME_ONE_SECOND);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZB_BDB_SIGNAL_STEERING:
|
|
||||||
if (status == RET_OK) {
|
|
||||||
ESP_LOGI(TAG, "Network steering started");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZB_ZDO_SIGNAL_DEVICE_ANNCE:
|
|
||||||
dev_annce_params = ZB_ZDO_SIGNAL_GET_PARAMS(p_sg_p, zb_zdo_signal_device_annce_params_t);
|
|
||||||
ESP_LOGI(TAG, "New device commissioned or rejoined (short: 0x%04hx)", dev_annce_params->device_short_addr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ESP_LOGI(TAG, "status: %d", status);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* All callbacks should either reuse or free passed buffers. If bufid == 0, the buffer is invalid (not passed) */
|
|
||||||
if (bufid) {
|
|
||||||
zb_buf_free(bufid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void app_main(void)
|
|
||||||
{
|
|
||||||
zb_ret_t zb_err_code;
|
|
||||||
zb_esp_platform_config_t config = {
|
|
||||||
.radio_config = ZB_ESP_DEFAULT_RADIO_CONFIG(),
|
|
||||||
.host_config = ZB_ESP_DEFAULT_HOST_CONFIG(),
|
|
||||||
};
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(zb_esp_platform_config(&config));
|
|
||||||
/* initialize Zigbee stack */
|
|
||||||
ZB_INIT("light_coordinator");
|
|
||||||
zb_set_network_coordinator_role(IEEE_CHANNEL_MASK);
|
|
||||||
zb_set_nvram_erase_at_start(ERASE_PERSISTENT_CONFIG);
|
|
||||||
zb_set_max_children(MAX_CHILDREN);
|
|
||||||
zb_err_code = zboss_start_no_autostart();
|
|
||||||
ESP_ERROR_CHECK(zb_err_code);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
zboss_main_loop_iteration();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form, except as embedded into a Espressif Systems
|
|
||||||
* integrated circuit in a product or a software update for such product,
|
|
||||||
* must reproduce the above copyright notice, this list of conditions and
|
|
||||||
* the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* 4. Any software provided in binary form under this license must not be reverse
|
|
||||||
* engineered, decompiled, modified and/or disassembled.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "zboss_api.h"
|
|
||||||
|
|
||||||
/* Zigbee Configuration */
|
|
||||||
#define IEEE_CHANNEL_MASK (1l << 13) /* Zigbee default setting is channel 13 for light example usage */
|
|
||||||
#define ERASE_PERSISTENT_CONFIG ZB_TRUE /* erase network devices before running example */
|
|
||||||
#define MAX_CHILDREN 10 /* the max amount of connected devices */
|
|
||||||
#define ZB_ESP_DEFAULT_RADIO_CONFIG() \
|
|
||||||
{ \
|
|
||||||
.radio_mode = RADIO_MODE_NATIVE, \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ZB_ESP_DEFAULT_HOST_CONFIG() \
|
|
||||||
{ \
|
|
||||||
.host_connection_mode = HOST_CONNECTION_MODE_NONE, \
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
## IDF Component Manager Manifest File
|
|
||||||
dependencies:
|
|
||||||
espressif/esp-zboss-lib: "~0.0.4"
|
|
||||||
## Required IDF version
|
|
||||||
idf:
|
|
||||||
version: ">=5.0.0"
|
|
@@ -1,6 +0,0 @@
|
|||||||
# Name, Type, SubType, Offset, Size, Flags
|
|
||||||
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
|
|
||||||
nvs, data, nvs, 0x9000, 0x6000,
|
|
||||||
phy_init, data, phy, 0xf000, 0x1000,
|
|
||||||
factory, app, factory, 0x10000, 1M,
|
|
||||||
zb_storage, data, fat, , 128K,
|
|
|
@@ -1,36 +0,0 @@
|
|||||||
CONFIG_IDF_TARGET="esp32h2"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Partition Table
|
|
||||||
#
|
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
|
||||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
|
||||||
CONFIG_PARTITION_TABLE_MD5=y
|
|
||||||
# end of Partition Table
|
|
||||||
|
|
||||||
#
|
|
||||||
# mbedTLS
|
|
||||||
#
|
|
||||||
CONFIG_MBEDTLS_HARDWARE_AES=n
|
|
||||||
CONFIG_MBEDTLS_HARDWARE_MPI=n
|
|
||||||
CONFIG_MBEDTLS_HARDWARE_SHA=n
|
|
||||||
CONFIG_MBEDTLS_CMAC_C=y
|
|
||||||
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
|
|
||||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y
|
|
||||||
# end of TLS Key Exchange Methods
|
|
||||||
|
|
||||||
CONFIG_MBEDTLS_ECJPAKE_C=y
|
|
||||||
# end of mbedTLS
|
|
||||||
|
|
||||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
|
||||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
|
||||||
|
|
||||||
#
|
|
||||||
# Zboss
|
|
||||||
#
|
|
||||||
CONFIG_ZB_ENABLED=y
|
|
||||||
CONFIG_ZB_ZCZR=y
|
|
||||||
# end of Zboss
|
|
||||||
# end of Component config
|
|
@@ -9,10 +9,9 @@ This test code shows how to configure Zigbee end device and use it as a light sw
|
|||||||
|
|
||||||
## Hardware Required
|
## Hardware Required
|
||||||
|
|
||||||
* One development board with ESP32-H2 SoC acting as Zigbee end device (loaded with light switch example)
|
* One development board with ESP32-H2 SoC acting as Zigbee coordinator (loaded with light switch example)
|
||||||
* A USB cable for power supply and programming
|
* A USB cable for power supply and programming
|
||||||
* Choose another ESP32-H2 as Zigbee coordinator (see [light coordinator example](../light_coordinator))
|
* Choose another ESP32-H2 as Zigbee end-device (see [light bulb example](../light_bulb))
|
||||||
* Choose another ESP32-H2 as Zigbee router (see [light bulb example](../light_bulb))
|
|
||||||
|
|
||||||
## Configure the project
|
## Configure the project
|
||||||
|
|
||||||
@@ -29,18 +28,24 @@ Build the project, flash it to the board, and start the monitor tool to view the
|
|||||||
As you run the example, you will see the following log:
|
As you run the example, you will see the following log:
|
||||||
|
|
||||||
light switch:
|
light switch:
|
||||||
I (9423) gpio: GPIO[9]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
|
I (767) gpio: GPIO[9]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
|
||||||
I (9523) ESP_ZB_SWITCH: status: -1
|
I (857) ESP_ZB_SWITCH: status: 255
|
||||||
I (9523) ESP_ZB_SWITCH: Zigbee stack initialized
|
I (857) ESP_ZB_SWITCH: Zigbee stack initialized
|
||||||
I (9523) ESP_ZB_SWITCH: Start network steering
|
I (857) ESP_ZB_SWITCH: Start network formation
|
||||||
I (11263) ESP_ZB_SWITCH: Joined network successfully (Extended PAN ID: f9:54:2d:01:a0:03:f7:84, PAN ID: 0xf5b5)
|
I (1377) ESP_ZB_SWITCH: Joined network successfully (Extended PAN ID: aa:98:48:01:a0:03:f7:84, PAN ID: 0xb8db)
|
||||||
I (13433) ESP_ZB_SWITCH: Found bulb addr: 0x434a ep: 10
|
I (1837) ESP_ZB_SWITCH: status: 0
|
||||||
I (16433) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
I (1837) ESP_ZB_SWITCH: Network steering started
|
||||||
I (17663) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
I (6587) ESP_ZB_SWITCH: status: 0
|
||||||
I (18693) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
I (7097) ESP_ZB_SWITCH: status: 0
|
||||||
I (19833) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
I (7147) ESP_ZB_SWITCH: New device commissioned or rejoined (short: 0xd200)
|
||||||
I (20753) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
I (7717) ESP_ZB_SWITCH: status: 0
|
||||||
I (21363) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
I (7757) ESP_ZB_SWITCH: status: 0
|
||||||
|
I (9217) ESP_ZB_SWITCH: Found bulb addr: 0x77ea ep: 10
|
||||||
|
I (11657) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
||||||
|
I (12197) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
||||||
|
I (12547) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
||||||
|
I (12857) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
||||||
|
I (17327) ESP_ZB_SWITCH: Send ON/OFF toggle command
|
||||||
|
|
||||||
## Light Control Functions
|
## Light Control Functions
|
||||||
|
|
||||||
|
@@ -36,13 +36,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
#include "esp_zb_switch.h"
|
#include "esp_zb_switch.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note Make sure set idf.py menuconfig in zigbee component as zigbee end device!
|
* @note Make sure set idf.py menuconfig in zigbee component as zigbee coordinator device!
|
||||||
*/
|
*/
|
||||||
#if !defined ZB_ED_ROLE
|
#if defined ZB_ED_ROLE
|
||||||
#error Define ZB_ED_ROLE in idf.py menuconfig to compile light switch (End Device) source code.
|
#error Define ZB_COORDINATOR_ROLE in idf.py menuconfig to compile light switch source code.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* define Button function currently only 1 switch define */
|
/* define Button function currently only 1 switch define */
|
||||||
@@ -56,8 +58,6 @@ static switch_device_ctx_t esp_switch_ctx = {
|
|||||||
.basic_attr.power_source = ZB_ZCL_BASIC_POWER_SOURCE_UNKNOWN,
|
.basic_attr.power_source = ZB_ZCL_BASIC_POWER_SOURCE_UNKNOWN,
|
||||||
/* identify cluster attributes data */
|
/* identify cluster attributes data */
|
||||||
.identify_attr.identify_time = 0,
|
.identify_attr.identify_time = 0,
|
||||||
/* On_Off cluster attributes data */
|
|
||||||
.on_off_attr.on_off = 0,
|
|
||||||
/* bulb parameters */
|
/* bulb parameters */
|
||||||
.bulb_params.short_addr = 0xffff,
|
.bulb_params.short_addr = 0xffff,
|
||||||
};
|
};
|
||||||
@@ -234,10 +234,11 @@ static void bdb_start_top_level_commissioning_cb(zb_uint8_t mode_mask)
|
|||||||
void zboss_signal_handler(zb_bufid_t bufid)
|
void zboss_signal_handler(zb_bufid_t bufid)
|
||||||
{
|
{
|
||||||
zb_zdo_app_signal_hdr_t *p_sg_p = NULL;
|
zb_zdo_app_signal_hdr_t *p_sg_p = NULL;
|
||||||
|
zb_uint8_t status = ZB_GET_APP_SIGNAL_STATUS(bufid);
|
||||||
zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &p_sg_p);
|
zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &p_sg_p);
|
||||||
zb_ret_t status = ZB_GET_APP_SIGNAL_STATUS(bufid);
|
zb_zdo_signal_device_annce_params_t *dev_annce_params = NULL;
|
||||||
zb_ret_t zb_err_code;
|
zb_ret_t zb_err_code;
|
||||||
|
zb_nlme_permit_joining_request_t *request = NULL;
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case ZB_ZDO_SIGNAL_SKIP_STARTUP:
|
case ZB_ZDO_SIGNAL_SKIP_STARTUP:
|
||||||
ESP_LOGI(TAG, "Zigbee stack initialized");
|
ESP_LOGI(TAG, "Zigbee stack initialized");
|
||||||
@@ -245,13 +246,13 @@ void zboss_signal_handler(zb_bufid_t bufid)
|
|||||||
break;
|
break;
|
||||||
case ZB_BDB_SIGNAL_DEVICE_FIRST_START:
|
case ZB_BDB_SIGNAL_DEVICE_FIRST_START:
|
||||||
if (status == RET_OK) {
|
if (status == RET_OK) {
|
||||||
ESP_LOGI(TAG, "Start network steering");
|
ESP_LOGI(TAG, "Start network formation");
|
||||||
bdb_start_top_level_commissioning(ZB_BDB_NETWORK_STEERING);
|
bdb_start_top_level_commissioning(ZB_BDB_NETWORK_FORMATION);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "Failed to initialize Zigbee stack (status: %d)", status);
|
ESP_LOGE(TAG, "Failed to initialize Zigbee stack (status: %d)", status);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZB_BDB_SIGNAL_STEERING:
|
case ZB_BDB_SIGNAL_FORMATION:
|
||||||
if (status == RET_OK) {
|
if (status == RET_OK) {
|
||||||
zb_ext_pan_id_t extended_pan_id;
|
zb_ext_pan_id_t extended_pan_id;
|
||||||
zb_get_extended_pan_id(extended_pan_id);
|
zb_get_extended_pan_id(extended_pan_id);
|
||||||
@@ -259,6 +260,22 @@ void zboss_signal_handler(zb_bufid_t bufid)
|
|||||||
extended_pan_id[7], extended_pan_id[6], extended_pan_id[5], extended_pan_id[4],
|
extended_pan_id[7], extended_pan_id[6], extended_pan_id[5], extended_pan_id[4],
|
||||||
extended_pan_id[3], extended_pan_id[2], extended_pan_id[1], extended_pan_id[0],
|
extended_pan_id[3], extended_pan_id[2], extended_pan_id[1], extended_pan_id[0],
|
||||||
ZB_PIBCACHE_PAN_ID());
|
ZB_PIBCACHE_PAN_ID());
|
||||||
|
bdb_start_top_level_commissioning(ZB_BDB_NETWORK_STEERING);
|
||||||
|
} else {
|
||||||
|
ESP_LOGI(TAG, "Restart network formation (status: %d)", status);
|
||||||
|
ZB_SCHEDULE_APP_ALARM((zb_callback_t)bdb_start_top_level_commissioning_cb, ZB_BDB_NETWORK_FORMATION, ZB_TIME_ONE_SECOND);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ZB_BDB_SIGNAL_STEERING:
|
||||||
|
if (status == RET_OK) {
|
||||||
|
request = ZB_BUF_GET_PARAM(bufid, zb_nlme_permit_joining_request_t);
|
||||||
|
ESP_LOGI(TAG, "Network steering started/refreshed");
|
||||||
|
ZB_SCHEDULE_APP_ALARM((zb_callback_t)bdb_start_top_level_commissioning_cb, ZB_BDB_NETWORK_STEERING, (request->permit_duration)*ZB_TIME_ONE_SECOND);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ZB_ZDO_SIGNAL_DEVICE_ANNCE:
|
||||||
|
dev_annce_params = ZB_ZDO_SIGNAL_GET_PARAMS(p_sg_p, zb_zdo_signal_device_annce_params_t);
|
||||||
|
ESP_LOGI(TAG, "New device commissioned or rejoined (short: 0x%04hx)", dev_annce_params->device_short_addr);
|
||||||
/* check the light device address */
|
/* check the light device address */
|
||||||
if (!esp_zb_already_find_light_bulb()) {
|
if (!esp_zb_already_find_light_bulb()) {
|
||||||
zb_err_code = ZB_SCHEDULE_APP_ALARM(esp_zb_find_light_bulb, bufid, MATCH_DESC_REQ_START_DELAY);
|
zb_err_code = ZB_SCHEDULE_APP_ALARM(esp_zb_find_light_bulb, bufid, MATCH_DESC_REQ_START_DELAY);
|
||||||
@@ -267,10 +284,6 @@ void zboss_signal_handler(zb_bufid_t bufid)
|
|||||||
ESP_ERROR_CHECK(zb_err_code);
|
ESP_ERROR_CHECK(zb_err_code);
|
||||||
bufid = 0; /* Do not free buffer - it will be reused by find_light_bulb callback */
|
bufid = 0; /* Do not free buffer - it will be reused by find_light_bulb callback */
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ESP_LOGI(TAG, "Network steering was not successful (status: %d)", status);
|
|
||||||
ZB_SCHEDULE_APP_ALARM((zb_callback_t)bdb_start_top_level_commissioning_cb, ZB_BDB_NETWORK_STEERING, ZB_TIME_ONE_SECOND);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ESP_LOGI(TAG, "status: %d", status);
|
ESP_LOGI(TAG, "status: %d", status);
|
||||||
@@ -281,29 +294,30 @@ void zboss_signal_handler(zb_bufid_t bufid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main(void)
|
static void zboss_task(void *pvParameters)
|
||||||
{
|
{
|
||||||
zb_ret_t zb_err_code;
|
|
||||||
zb_esp_platform_config_t config = {
|
|
||||||
.radio_config = ZB_ESP_DEFAULT_RADIO_CONFIG(),
|
|
||||||
.host_config = ZB_ESP_DEFAULT_HOST_CONFIG(),
|
|
||||||
};
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(zb_esp_platform_config(&config));
|
|
||||||
/* initialize Zigbee stack. */
|
/* initialize Zigbee stack. */
|
||||||
ZB_INIT("light_switch");
|
ZB_INIT("light_switch");
|
||||||
zb_set_network_ed_role(IEEE_CHANNEL_MASK);
|
zb_set_network_coordinator_role(IEEE_CHANNEL_MASK);
|
||||||
|
zb_set_max_children(MAX_CHILDREN);
|
||||||
zb_set_nvram_erase_at_start(ERASE_PERSISTENT_CONFIG);
|
zb_set_nvram_erase_at_start(ERASE_PERSISTENT_CONFIG);
|
||||||
zb_set_ed_timeout(ED_AGING_TIMEOUT_64MIN);
|
|
||||||
zb_set_keepalive_timeout(ZB_MILLISECONDS_TO_BEACON_INTERVAL(3000));
|
|
||||||
/* hardware related and device init */
|
/* hardware related and device init */
|
||||||
switch_driver_init(button_func_pair, PAIR_SIZE(button_func_pair), esp_zb_buttons_handler);
|
switch_driver_init(button_func_pair, PAIR_SIZE(button_func_pair), esp_zb_buttons_handler);
|
||||||
/* register on_off switch device context (endpoints) */
|
/* register on_off switch device context (endpoints) */
|
||||||
ZB_AF_REGISTER_DEVICE_CTX(&on_off_switch_ctx);
|
ZB_AF_REGISTER_DEVICE_CTX(&on_off_switch_ctx);
|
||||||
zb_err_code = zboss_start_no_autostart();
|
ESP_ERROR_CHECK(zboss_start_no_autostart());
|
||||||
ESP_ERROR_CHECK(zb_err_code);
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
zboss_main_loop_iteration();
|
zboss_main_loop_iteration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void app_main(void)
|
||||||
|
{
|
||||||
|
zb_esp_platform_config_t config = {
|
||||||
|
.radio_config = ZB_ESP_DEFAULT_RADIO_CONFIG(),
|
||||||
|
.host_config = ZB_ESP_DEFAULT_HOST_CONFIG(),
|
||||||
|
};
|
||||||
|
/* load Zigbee switch platform config to initialization */
|
||||||
|
ESP_ERROR_CHECK(zb_esp_platform_config(&config));
|
||||||
|
xTaskCreate(zboss_task, "zboss_main", 4096, NULL, 5, NULL);
|
||||||
|
}
|
||||||
|
@@ -42,6 +42,7 @@
|
|||||||
/* Zigbee configuration */
|
/* Zigbee configuration */
|
||||||
#define IEEE_CHANNEL_MASK (1l << 13) /* ZigBee default setting is channel 13 for light example usage */
|
#define IEEE_CHANNEL_MASK (1l << 13) /* ZigBee default setting is channel 13 for light example usage */
|
||||||
#define ERASE_PERSISTENT_CONFIG ZB_TRUE /* erase network devices before running example */
|
#define ERASE_PERSISTENT_CONFIG ZB_TRUE /* erase network devices before running example */
|
||||||
|
#define MAX_CHILDREN 10 /* the max number of connected devices */
|
||||||
|
|
||||||
/* ZCL configuration */
|
/* ZCL configuration */
|
||||||
#define HA_ONOFF_SWITCH_ENDPOINT 1
|
#define HA_ONOFF_SWITCH_ENDPOINT 1
|
||||||
@@ -58,7 +59,6 @@ typedef struct light_switch_bulb_params_s {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
zb_zcl_basic_attrs_t basic_attr;
|
zb_zcl_basic_attrs_t basic_attr;
|
||||||
zb_zcl_identify_attrs_t identify_attr;
|
zb_zcl_identify_attrs_t identify_attr;
|
||||||
zb_zcl_on_off_attrs_t on_off_attr;
|
|
||||||
light_switch_bulb_params_t bulb_params;
|
light_switch_bulb_params_t bulb_params;
|
||||||
} switch_device_ctx_t;
|
} switch_device_ctx_t;
|
||||||
#define ZB_ESP_DEFAULT_RADIO_CONFIG() \
|
#define ZB_ESP_DEFAULT_RADIO_CONFIG() \
|
||||||
|
@@ -31,6 +31,6 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
|||||||
# Zboss
|
# Zboss
|
||||||
#
|
#
|
||||||
CONFIG_ZB_ENABLED=y
|
CONFIG_ZB_ENABLED=y
|
||||||
CONFIG_ZB_ZED=y
|
CONFIG_ZB_ZCZR=y
|
||||||
# end of Zboss
|
# end of Zboss
|
||||||
# end of Component config
|
# end of Component config
|
||||||
|
Reference in New Issue
Block a user