Closed renatomotorline closed 4 weeks ago
Hi @renatomotorline ,
The IAS Zone cluster supports three methods for device enrollment, though it's unclear which one is used by the SonOff SNZB-03
. It might be best to observe the communication with a sniffer to compare successful and failed attempts. Alternatively, feel free to share the .pcap
files of both cases, and I can help analyze the issue.
I successfully received the status by utilizing the "Auto-Enroll-Response" enrolling method, and after that, I send a config report command(esp_zb_zcl_config_report_cmd_req
). Now, every time I pass in front of the sensor I receive an ESP_ZB_CORE_CMD_IAS_ZONE_ZONE_STATUS_CHANGE_NOT_ID
event.
esp_zb_zcl_write_attr_cmd_t cie_write_req;
cie_write_req.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
memcpy(cie_write_req.zcl_basic_cmd.dst_addr_u.addr_long, ieee_addr,
sizeof(esp_zb_ieee_addr_t));
cie_write_req.zcl_basic_cmd.src_endpoint = GATEWAY_ENDPOINT;
cie_write_req.zcl_basic_cmd.dst_endpoint = endpoint_id;
cie_write_req.clusterID = ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE;
// Get gateway address
esp_zb_ieee_addr_t addr = {0};
esp_zb_get_long_address(addr);
// Write the CIE Address (Gateway's IEEE Address)
esp_zb_zcl_attribute_t cie_attribute;
cie_attribute.id = ESP_ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID;
cie_attribute.data.type = ESP_ZB_ZCL_ATTR_TYPE_IEEE_ADDR;
cie_attribute.data.size = sizeof(esp_zb_ieee_addr_t);
cie_attribute.data.value = addr;
cie_write_req.attr_field = &cie_attribute;
cie_write_req.attr_number = 1;
esp_zb_lock_acquire(portMAX_DELAY);
uint8_t seq = esp_zb_zcl_write_attr_cmd_req(&cie_write_req);
esp_zb_lock_release();
esp_zb_zcl_ias_zone_enroll_response_cmd_t cmd_resp;
cmd_resp.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
memcpy(cmd_resp.zcl_basic_cmd.dst_addr_u.addr_long, device->ieee_addr,
sizeof(esp_zb_ieee_addr_t));
cmd_resp.zcl_basic_cmd.dst_endpoint = endpoint_id;
cmd_resp.zcl_basic_cmd.src_endpoint = GATEWAY_ENDPOINT;
cmd_resp.zone_id = zone_id;
cmd_resp.enroll_rsp_code = ESP_ZB_ZCL_IAS_ZONE_ENROLL_RESPONSE_CODE_SUCCESS;
esp_zb_lock_acquire(portMAX_DELAY);
uint8_t seq = esp_zb_zcl_ias_zone_enroll_cmd_resp(&cmd_resp);
esp_zb_lock_release();
esp_zb_zcl_config_report_cmd_t report_cmd;
report_cmd.zcl_basic_cmd.dst_addr_u.addr_short = short_addr;
report_cmd.zcl_basic_cmd.dst_endpoint = dst_endpoint;
report_cmd.zcl_basic_cmd.src_endpoint = GATEWAY_ENDPOINT;
report_cmd.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
report_cmd.clusterID = ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE;
esp_zb_zcl_config_report_record_t records_window[] = {{
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV, // Request direction
.attributeID = ESP_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID,
.attrType = ESP_ZB_ZCL_ATTR_TYPE_16BITMAP, // Attribute variable type
.min_interval = 0, // Min report time
.max_interval = 30, // Max report time
.reportable_change = &min_change,
}};
report_cmd.record_number =
sizeof(records_window) / sizeof(esp_zb_zcl_config_report_record_t);
report_cmd.record_field = records_window;
esp_zb_lock_acquire(portMAX_DELAY);
uint8_t seq = esp_zb_zcl_config_report_cmd_req(&report_cmd);
esp_zb_lock_release();
I'm trying to follow the Auto Enroll Request detailed in https://github.com/espressif/esp-zigbee-sdk/issues/42#issuecomment-1639229015 I'm able to set the CIE address using the following code:
After executing this code, I performed a read attribute operation on
ESP_ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID
, and the address matched the one retrieved fromesp_zb_get_long_address
. However, I am not receiving any Zone Enroll request (ESP_ZB_CORE_CMD_IAS_ZONE_ZONE_ENROLL_REQUEST_ID
).Sensor Model: SonOff SNZB-03
With Zigbee2Mqtt the device enrolls successfully:
What could be causing the lack of Zone Enroll requests in my implementation? Are there any additional steps needed after setting the CIE address to trigger the enroll request?