-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Hey,
Setup:
IDF v5.4.1, zboss-lib v1.6.4, zigbee-lib v1.6.5
im working on a ESP32C6 end device based on light sleep example connected to Zigbee2Mqtt coordinator. As it is necessary to transmit strings from the end device to the coordinator I want to add a manufacturerer specific cluster to the end device, which I tried with replacing the example projects code in esp_zb_task with code from custom cluster example.
Problem:
The custom cluster is correctly recognized by Z2M, but trying to issue an esp_zb_zcl_report_attr_cmd_req fails (no log in Z2M) and frequent crashes caused by watchdog.
Question:
I assume I am missing something. Maybe some settings in the cmd need other configuration?
I appreaciate any help
Additional context.
Serial log:
I (10467) ESP_ZB_SLEEP: Zigbee can sleep
--- Error: ClearCommError failed (PermissionError(13, 'Das Gerät erkennt den Befehl nicht.', None, 22))
--- Waiting for the device to reconnect
I (12810) ESP_ZB_SLEEP: Zigbee can sleep
--- Error: ClearCommError failed (PermissionError(13, 'Das Gerät erkennt den Befehl nicht.', None, 22))
--- Waiting for the device to reconnect.
E (18650) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (18650) task_wdt: - IDLE (CPU 0)
E (18650) task_wdt: Tasks currently running:
E (18650) task_wdt: CPU 0: Zigbee_main
E (18650) task_wdt: Print CPU 0 (current core) backtrace
esp_backtrace_print: Print CPU 0 (current core) registers
esp_zb_task:
static void esp_zb_task(void *pvParameters)
{
/* initialize Zigbee stack with Zigbee end-device config */
esp_zb_cfg_t zb_nwk_cfg = ESP_ZB_ZED_CONFIG();
/* Enable zigbee light sleep */
esp_zb_sleep_enable(true);
esp_zb_init(&zb_nwk_cfg);
//=================================
esp_zb_ep_list_t *ep_list = esp_zb_ep_list_create();
esp_zb_endpoint_config_t endpoint_config = {
.endpoint = CUSTOM_SERVER_ENDPOINT,
.app_profile_id = ESP_ZB_AF_HA_PROFILE_ID,
.app_device_id = ESP_ZB_HA_CUSTOM_ATTR_DEVICE_ID,
.app_device_version = 0,
};
esp_zb_cluster_list_t *cluster_list = esp_zb_zcl_cluster_list_create();
esp_zb_attribute_list_t *custom_cluster = esp_zb_zcl_attr_list_create(CUSTOM_CLUSTER_ID);
uint16_t custom_attr1_id = 0x0000;
uint8_t custom_attr1_value[] = "\x0b""hello world";
uint16_t custom_attr2_id = 0x0001;
uint16_t custom_attr2_value = 0x1234;
esp_zb_custom_cluster_add_custom_attr(custom_cluster, custom_attr1_id, ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING,
ESP_ZB_ZCL_ATTR_ACCESS_READ_WRITE | ESP_ZB_ZCL_ATTR_ACCESS_REPORTING, custom_attr1_value);
esp_zb_custom_cluster_add_custom_attr(custom_cluster, custom_attr2_id, ESP_ZB_ZCL_ATTR_TYPE_U16, ESP_ZB_ZCL_ATTR_ACCESS_READ_WRITE | ESP_ZB_ZCL_ATTR_ACCESS_REPORTING,
&custom_attr2_value);
/* Mandatory clusters */
esp_zb_cluster_list_add_basic_cluster(cluster_list, esp_zb_basic_cluster_create(NULL), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
esp_zb_cluster_list_add_identify_cluster(cluster_list, esp_zb_identify_cluster_create(NULL), ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
/* Custom cluster */
esp_zb_cluster_list_add_custom_cluster(cluster_list, custom_cluster, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
esp_zb_ep_list_add_ep(ep_list, cluster_list, endpoint_config);
esp_zb_device_register(ep_list);
//=================================
esp_zb_core_action_handler_register(zb_action_handler);
esp_zb_set_primary_network_channel_set(ESP_ZB_PRIMARY_CHANNEL_MASK);
ESP_ERROR_CHECK(esp_zb_start(false));
esp_zb_stack_main_loop();
}
zb_buttons_handler
static void zb_buttons_handler(switch_func_pair_t* button_func_pair)
{
if (button_func_pair->func == SWITCH_ONOFF_TOGGLE_CONTROL) {
ESP_LOGI(TAG, "Sensor Interrupt!");
const TickType_t xDelay = 10000 / portTICK_PERIOD_MS;
vTaskDelay(xDelay);
esp_zb_zcl_report_attr_cmd_t cmd = { 0 };
esp_zb_addr_u addr = { 0x0000 };
cmd.zcl_basic_cmd.dst_addr_u = addr;
cmd.zcl_basic_cmd.dst_endpoint = 0x01;
cmd.zcl_basic_cmd.src_endpoint = CUSTOM_SERVER_ENDPOINT;
cmd.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
cmd.clusterID = CUSTOM_CLUSTER_ID;
cmd.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI;
cmd.manuf_code = 0x1234;
cmd.attributeID = 0x0000;
esp_zb_lock_acquire(portMAX_DELAY);
esp_zb_zcl_report_attr_cmd_req(&cmd);
esp_zb_lock_release();
}
}
The other code is the similar to the example.