Replies: 7 comments
-
Hi, this Can you please better explain your scenario? You want to have switch-switch binding? If yes, you may also need to bind the CLIENT ON/OFF cluster you added as its done in Thermostat class. |
Beta Was this translation helpful? Give feedback.
-
I am developing an ESP32-C6 as a Zigbee switch coordinator using the Arduino IDE. I have successfully paired it with a commercial wall light switch (Tuya), and I can control the on/off state from the C6. I can also poll the on/off attribute to read its state correctly. However, I would like the C6 to receive the updated state automatically when the user physically toggles the Tuya wall switch. From GPT and other sources, I found that status: 135 means UNREPORTABLE_ATTRIBUTE, so I am wondering if I misconfigured something. Could you please advise? static esp_err_t zb_attribute_reporting_handler(const esp_zb_zcl_report_attr_message_t *message)
{
if (!message)
{
log_e("Empty message");
}
if (message->status != ESP_ZB_ZCL_STATUS_SUCCESS)
{
log_e("Received message: error status(%d)", message->status);
}
log_v(
"Received report from address(0x%x) src endpoint(%d) to dst endpoint(%d) cluster(0x%x)", message->src_address.u.short_addr, message->src_endpoint,
message->dst_endpoint, message->cluster);
// List through all Zigbee EPs and call the callback function, with the message
for (std::list<ZigbeeEP *>::iterator it = Zigbee.ep_objects.begin(); it != Zigbee.ep_objects.end(); ++it)
{
if (message->dst_endpoint == (*it)->getEndpoint())
{
(*it)->zbAttributeRead(message->cluster, &message->attribute); // method zbAttributeRead must be implemented in specific EP class
}
}
return ESP_OK;
} Because no logs are printed by this code, it appears execution never reaches zbAttributeRead(). I believe the config report setup itself is incorrect. |
Beta Was this translation helpful? Give feedback.
-
You should take a look on the Zigbee 3.0 Cluster Specification document and check the on/off cluster and its attributes to see If they are reportable. Sorry I have missed the status before. I will take a look also. |
Beta Was this translation helpful? Give feedback.
-
I will compare the binding details in |
Beta Was this translation helpful? Give feedback.
-
Congratulations! I successfully got state reporting working. After pairing the Tuya commercial wall switch and physically toggling it ON/OFF, the state was automatically reported even without setting up a config report. I set up bidirectional binding as shown in the code below, similar to the Thermostat example. However, as a beginner with Zigbee, I still have an issue to resolve. I bound the device to a 3-gang wall switch, but currently only endpoint 1 is reporting. In the findCb() function stage, is it possible to check how many endpoints the switch has? If I can determine the number of endpoints, should I then create bindings for each of them? I’d really appreciate it if you could help me just a little further. void ZigbeeSwitch::findCb(esp_zb_zdp_status_t zdo_status, uint16_t addr, uint8_t endpoint, void *user_ctx)
{
if (zdo_status == ESP_ZB_ZDP_STATUS_SUCCESS)
{
log_d("Found light endpoint");
zb_device_params_t *light = (zb_device_params_t *)malloc(sizeof(zb_device_params_t));
light->endpoint = endpoint;
light->short_addr = addr;
esp_zb_ieee_address_by_short(light->short_addr, light->ieee_addr);
uint8_t my_endpoint = *((uint8_t *)user_ctx);
// 1. For report recv
esp_zb_zdo_bind_req_param_t bind_req = {0};
bind_req.req_dst_addr = addr;
memcpy(bind_req.src_address, light->ieee_addr, sizeof(esp_zb_ieee_addr_t));
bind_req.src_endp = endpoint;
bind_req.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_ON_OFF;
bind_req.dst_addr_mode = ESP_ZB_ZDO_BIND_DST_ADDR_MODE_64_BIT_EXTENDED;
esp_zb_get_long_address(bind_req.dst_address_u.addr_long); // 내 주소
bind_req.dst_endp = my_endpoint;
log_i("Request light to bind us (for reporting)");
esp_zb_zdo_device_bind_req(&bind_req, bindCb, (void *)light);
// 2. For Cmd send
memset(&bind_req, 0, sizeof(bind_req));
bind_req.req_dst_addr = esp_zb_get_short_address();
esp_zb_get_long_address(bind_req.src_address);
bind_req.src_endp = my_endpoint;
bind_req.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_ON_OFF;
bind_req.dst_addr_mode = ESP_ZB_ZDO_BIND_DST_ADDR_MODE_64_BIT_EXTENDED;
memcpy(bind_req.dst_address_u.addr_long, light->ieee_addr, sizeof(esp_zb_ieee_addr_t));
bind_req.dst_endp = endpoint;
log_i("Try to bind On/Off (for control)");
esp_zb_zdo_device_bind_req(&bind_req, bindCb, (void *)light);
}
else
{
log_d("No light endpoint found");
}
} Log (VALUE is On & OFF)
|
Beta Was this translation helpful? Give feedback.
-
@luxert Can you share your .ino file and complete custom ZigbeeSwitch class? So I can take a look and try to help. |
Beta Was this translation helpful? Give feedback.
-
Moving to discussions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Board
ESP32 C6
Device Description
ESP32 C6 devkit
Hardware Configuration
None
Version
v3.1.1
Type
Question
IDE Name
Arduino IDE 2.x
Operating System
Windows11
Flash frequency
80Mhz
PSRAM enabled
no
Upload speed
921600
Description
I am testing an ESP32-C6 Zigbee switch.
I paired it with a commercial wall switch, and the wall switch works fine when I send on/off commands from the C6.
However, I would like to receive the status on the C6 when the user physically toggles the wall switch.
Therefore, I modified the switch creation as follows.
And I executed the following code to configure the reporting settings.
However, the following error is reported.
I referred to the thermostat example, which has both server and client roles.
I’m not sure what I did wrong.
Does anyone happen to know?
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
Beta Was this translation helpful? Give feedback.
All reactions