Skip to content

Allow ZigbeeEP implementers to handle custom commands #12025

@IAPark

Description

@IAPark

Related area

Zigbee

Hardware specification

ESP32-C6/ESP32-H2

Is your feature request related to a problem?

See #12026

I'm implementing a dimmable light using the ZigbeeDimmableLight endpoint, but ran into issues when controlled by a Hue controller. It looks like the ZigbeeDimmableLight only reacts to the ESP_ZB_CORE_SET_ATTR_VALUE_CB_ID and not cluster specific commands like Off or Off with effect

Without this the cluster is unable to properly turn on and off as expected

Describe the solution you'd like

If ZigbeeCore registered a esp_zb_zcl_raw_command_callback_t and forwarded raw commands to implementing classes like ZigbeeDimmableLight it would be easy to handle these otherwise unhandled commands. Ideally we'd have a callback like zbRawCommand with the cluster id, command id, and data buffer being passed to the implementers

My understanding of zigbee and zboss is slightly week, but parsing this info seems to be as simple as:

bool esp_zb_raw_command_handler(uint8_t bufid) {
  zb_zcl_parsed_hdr_t *cmd_info = ZB_BUF_GET_PARAM(bufid, zb_zcl_parsed_hdr_t);

  printf("endpoint: %d, cluster id: 0x%x, command id: 0x%x", cmd_info->addr_data.common_data.dst_endpoint, cmd_info->cluster_id, cmd_info->cmd_id);
  uint8_t *buf = (uint8_t*) zb_buf_begin(bufid);
  printf(" buff: ");
  for (int i = 0; i < zb_buf_len(bufid); ++i) {
      printf("0x%02X ", buf[i]);
  }
  printf("\n");
  return false;
}

Describe alternatives you've considered

I'll likely implement a esp_zb_zcl_raw_command_callback_t myself and handle this for my project, but this is reaching into pretty poorly documented functionality and getting to this point took me a lot of hours of staring at documentation

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions