Skip to content

ezb_zcl_attr_desc_get_value not working #827

@luar123

Description

@luar123

Answers checklist.

  • I have read the documentation ESP Zigbee SDK Programming Guide and tried the debugging tips, the issue is not addressed there.
  • I have updated ESP Zigbee libs (esp-zboss-lib and esp-zigbee-lib) to the latest version, with corresponding IDF version, and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

5.5.4

esp-zigbee-lib version.

2.0.1

esp-zboss-lib version.

none

Espressif SoC revision.

ESP32-H2

What is the expected behavior?

ezb_zcl_attr_desc_get_value() should return a value.

What is the actual behavior?

I tried to apply the workaround from #751 (comment) to get the restored level value after turning off.

However, calling ezb_zcl_attr_desc_get_value() leads to Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.

Steps to reproduce.

static void zb_attribute_handler(ezb_zcl_set_attr_value_message_t *message) {
  // if the attribute is On/Off and it is set to Off, restore the previous level.
  ezb_zcl_attr_desc_t current_level;
  void *val = nullptr;
  if (message->info.cluster_id == EZB_ZCL_CLUSTER_ID_ON_OFF) {
    if (message->in.attribute.id == EZB_ZCL_ATTR_ON_OFF_ON_OFF_ID && !*(bool *) message->in.attribute.data.value) {
      ESP_LOGD(TAG, "turned off");
      if (ezb_zcl_get_cluster_desc(message->info.dst_ep, EZB_ZCL_CLUSTER_ID_LEVEL, EZB_ZCL_CLUSTER_SERVER) != NULL) {
        current_level = ezb_zcl_get_attr_desc(message->info.dst_ep, EZB_ZCL_CLUSTER_ID_LEVEL, EZB_ZCL_CLUSTER_SERVER,
                                              EZB_ZCL_ATTR_LEVEL_CURRENT_LEVEL_ID, EZB_ZCL_STD_MANUF_CODE);
        if (current_level) {
          ESP_LOGD(TAG, "got level");
          ezb_zcl_attr_desc_get_value(current_level, val);
        }
      }
    }
  }

And send off command.

More Information.

I believe this was working in v2.0.0

Trace:

0x4207b566: xQueueSemaphoreTake at /COMPONENT_FREERTOS_DIR/FreeRTOS-Kernel/queue.c:1731
0x4205c4be: event_start_select at /COMPONENT_VFS_DIR/vfs_eventfd.c:99
0x40805a16: prvCopyDataToQueue at /COMPONENT_FREERTOS_DIR/FreeRTOS-Kernel/queue.c:2470
0x420202fa: pthread_setspecific at /COMPONENT_PTHREAD_DIR/pthread_local_storage.c:228
0x4200992c: esphome::esp_log_printf_(int, char const*, int, char const*, ...) at /IDF_PROJECT/src/esphome/core/log.cpp:37
0x4202bc30: zcl_attr_desc_get_value at /builds/thread_zigbee/esp-zigbee/src/core/zcl/zcl_desc.c:143
0x4202b8a0: zcl_core_action_schedule at /builds/thread_zigbee/esp-zigbee/src/core/zcl/zcl_core.c:59
0x4202b8a0: zcl_core_action_schedule at /builds/thread_zigbee/esp-zigbee/src/core/zcl/zcl_core.c:54
0x4202adf6: zcl_message_notify_attr_value at /builds/thread_zigbee/esp-zigbee/src/core/zcl/zcl_common.c:67
0x42053a58: zcl_message_on_off_set_attr_value at /builds/thread_zigbee/esp-zigbee/src/core/api/zcl/cluster/level.c:157
0x42053ffe: level_cvc_affect_with_on_off_output_handler at /builds/thread_zigbee/esp-zigbee/src/core/api/zcl/cluster/level.c:553
0x42058b50: zcl_cvc_start at /builds/thread_zigbee/esp-zigbee/src/core/zcl/zcl_cvc.c:99
0x4203f1ae: tm_sched_process_timers_task at /builds/thread_zigbee/esp-zigbee/src/core/common/timer.c:154
0x4203f0e0: tasklet_sched_process at /builds/thread_zigbee/esp-zigbee/src/core/common/tasklet.c:95
0x42059d56: esp_zigbee_task_queue_process at /builds/thread_zigbee/esp-zigbee/src/platform_esp/esp-zigbee/platform/esp_zigbee_task_queue.c:105
0x420598bc: esp_zigbee_platform_process at /builds/thread_zigbee/esp-zigbee/src/platform_esp/esp-zigbee/platform/esp_zigbee_platform.c:124
0x42023090: esp_zigbee_launch_mainloop at /builds/thread_zigbee/esp-zigbee/src/platform_esp/esp-zigbee/src/esp_zigbee.c:133
0x42024dd8: zdo_dev_start at /builds/thread_zigbee/esp-zigbee/src/core/zdo/zdo_app.c:92
0x42024dd8: zdo_dev_start at /builds/thread_zigbee/esp-zigbee/src/core/zdo/zdo_app.c:79
0x42006244: ezb_task_ at /IDF_PROJECT/src/esphome/components/zigbee/zigbee.cpp:457
0x4202017c: pthread_cleanup_thread_specific_data_callback at /COMPONENT_PTHREAD_DIR/pthread_local_storage.c:126
[10:19:22.422]Core  0 register dump:
[10:19:22.422]MEPC    : 0x400195f2  RA      : 0x40809722  SP      : 0x4081fdb0  GP      : 0x4080c564  
[10:19:22.476]TP      : 0x40820060  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130  
[10:19:22.476]S0/FP   : 0x00000001  S1      : 0x00000011  A0      : 0x00000000  A1      : 0xffffffff  
[10:19:22.476]A2      : 0x00000001  A3      : 0x7f7f7f7f  A4      : 0x00000000  A5      : 0x00000004  
[10:19:22.476]A6      : 0x0000000c  A7      : 0x76757473  S2      : 0x000000b6  S3      : 0x4081fde0  
[10:19:22.476]S4      : 0x4081fdf8  S5      : 0x00000000  S6      : 0x00000000  S7      : 0x00000000  
[10:19:22.476]S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
[10:19:22.489]T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938  
[10:19:22.489]MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x00000005  MTVAL   : 0x00000000  
[10:19:22.489]MHARTID : 0x00000000  

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions