This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Read the signal of ack in Zigbee

I'm developing a Zigbee coordinator that works as an On-Off Switch for the Zigbee Profile HA: this connects to the Device Mains Power Outlet, again with the HA profile.

Among them are linked through the Finding & Binding procedure: when I press the ON button on the switch, the Main Power Outlet turns on.

What I need is the ACK response that automatically sends the Mains Power Outlet device when the value of the OnOff attribute changes following the request made by the coordinator: I need it because I have to manage actions following the fact if the device Mains Power Outlet has actually received my command (I also do not have visual access to the device so I have to rely on the response from the ACK to know if it received the command correctly or not).

I assumed that the ACK response is automatic and that it is activated when I declare the endpoint and I call this define: ZB_HA_MAINS_POWER_OUTLET_REPORT_ATTR_COUNT.

I assumed that the answer is automatic also because, if I connect the Mains Power Outlet endpoint to Amazon Echo, I see that, when I send the command, Alexa changes the state of the device in the App only after the device has responded and not before (if I have the device off and I try to turn it on via Alexa, this tells me that the device does not respond because obviously it has not received back response from the device).

I hope I have explained my doubts to the fullest.

Best regards,

Raffaela

Parents
  • Hi.

    I think this case got lost in the queue, I've just got it assigned to me.

    I looks similar to the case I already have with you, so lets keep the discussion there.

    Best regards,

    Andreas

  • Hi Andreas,

    Actually I understood what the problem was.

    I was looking for the Default Response because I wanted to be sure that the request sent by the Zigbee Coordinator was actually executed by the device.

    I will briefly explain my way to obtain the parsing of the Default Response by the Zigbee Coordinator:

    After sending the write attribute request through a specific command by the Coordinator to the Router, the Router executes the command and sends the Default Response back to the Zigbee Coordinator.

    To read the Default Response, I have to register the callback to handle the ZCL commands

    ZB_AF_SET_ENDPOINT_HANDLER(HA_WINDOW_CONTROLLER_ENDPOINT, zcl_device_cb

    When it arrives, I do this:

    zb_zcl_write_attr_res_t * p_attr_resp;
    zb_uint8_t status_resp = 0;
    
    static zb_void_t zcl_device_cb(zb_uint8_t param)
    {
        zb_buf_t                       * p_buffer = ZB_BUF_FROM_REF(param);
        zb_zcl_parsed_hdr_t * p_cmd_info = ZB_GET_BUF_PARAM(p_buffer, zb_zcl_parsed_hdr_t);
    
        ZB_ZCL_GET_NEXT_WRITE_ATTR_RES(p_buffer, p_attr_resp);
    
        status_resp = p_attr_resp->status;
    }

    My question is: In the struct "zb_zcl_write_attr_res_t", what is the "attr_id" field?

    Is it correct my approach?

    Thank you and best regards,

    Raffaela

Reply
  • Hi Andreas,

    Actually I understood what the problem was.

    I was looking for the Default Response because I wanted to be sure that the request sent by the Zigbee Coordinator was actually executed by the device.

    I will briefly explain my way to obtain the parsing of the Default Response by the Zigbee Coordinator:

    After sending the write attribute request through a specific command by the Coordinator to the Router, the Router executes the command and sends the Default Response back to the Zigbee Coordinator.

    To read the Default Response, I have to register the callback to handle the ZCL commands

    ZB_AF_SET_ENDPOINT_HANDLER(HA_WINDOW_CONTROLLER_ENDPOINT, zcl_device_cb

    When it arrives, I do this:

    zb_zcl_write_attr_res_t * p_attr_resp;
    zb_uint8_t status_resp = 0;
    
    static zb_void_t zcl_device_cb(zb_uint8_t param)
    {
        zb_buf_t                       * p_buffer = ZB_BUF_FROM_REF(param);
        zb_zcl_parsed_hdr_t * p_cmd_info = ZB_GET_BUF_PARAM(p_buffer, zb_zcl_parsed_hdr_t);
    
        ZB_ZCL_GET_NEXT_WRITE_ATTR_RES(p_buffer, p_attr_resp);
    
        status_resp = p_attr_resp->status;
    }

    My question is: In the struct "zb_zcl_write_attr_res_t", what is the "attr_id" field?

    Is it correct my approach?

    Thank you and best regards,

    Raffaela

Children
Related