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

Zigbee consecutive command issue

Hello,

if I call this code all works:

ZB_GET_OUT_BUF_DELAYED2(SendMoveToLevelCommandOnOffToBindings,0);

static zb_void_t SendMoveToLevelCommandOnOffToBindings(zb_uint8_t param, zb_uint16_t curr_local_entry_id)
{
    zb_uint8_t           cmd_id;
    zb_buf_t           * p_buf = ZB_BUF_FROM_REF(param); 

    
    ZB_ZCL_ON_OFF_SEND_ON_REQ(p_buf,
                                  local_binding_list[curr_local_entry_id].dstAddr,
                                  local_binding_list[curr_local_entry_id].dstAddrMode,
                                  local_binding_list[curr_local_entry_id].dstEP,
                                  local_binding_list[curr_local_entry_id].srcEP,
                                  ZB_AF_HA_PROFILE_ID,
                                  ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                                  NULL);


    ZB_GET_OUT_BUF_DELAYED2(SendMoveToLevelCommandToBindings,curr_local_entry_id);
}

static zb_void_t SendMoveToLevelCommandToBindings(zb_uint8_t param, zb_uint16_t curr_local_entry_id)
{
    zb_uint8_t           cmd_id;
    zb_buf_t           * p_buf = ZB_BUF_FROM_REF(param); 

    ZB_ZCL_LEVEL_CONTROL_SEND_MOVE_TO_LEVEL_REQ(p_buf, 
                                                local_binding_list[curr_local_entry_id].dstAddr, 
                                                local_binding_list[curr_local_entry_id].dstAddrMode,
                                                local_binding_list[curr_local_entry_id].dstEP, 
                                                local_binding_list[curr_local_entry_id].srcEP,
                                                ZB_AF_HA_PROFILE_ID, 
                                                ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                                                NULL,
                                                level_test_value, 0xFFFF);

}

if I call following code only ZB_ZCL_ON_OFF_SEND_ON_REQ take effect on target

ZB_GET_OUT_BUF_DELAYED2(SendMoveToLevelCommandToBindings,0);

static zb_void_t SendMoveToLevelCommandOnOffToBindings(zb_uint8_t param, zb_uint16_t curr_local_entry_id)
{
    zb_uint8_t           cmd_id;
    zb_buf_t           * p_buf = ZB_BUF_FROM_REF(param); 

    
    ZB_ZCL_ON_OFF_SEND_ON_REQ(p_buf,
                                  local_binding_list[curr_local_entry_id].dstAddr,
                                  local_binding_list[curr_local_entry_id].dstAddrMode,
                                  local_binding_list[curr_local_entry_id].dstEP,
                                  local_binding_list[curr_local_entry_id].srcEP,
                                  ZB_AF_HA_PROFILE_ID,
                                  ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                                  NULL);


    
}

static zb_void_t SendMoveToLevelCommandToBindings(zb_uint8_t param, zb_uint16_t curr_local_entry_id)
{
    zb_uint8_t           cmd_id;
    zb_buf_t           * p_buf = ZB_BUF_FROM_REF(param); 

    ZB_ZCL_LEVEL_CONTROL_SEND_MOVE_TO_LEVEL_REQ(p_buf, 
                                                local_binding_list[curr_local_entry_id].dstAddr, 
                                                local_binding_list[curr_local_entry_id].dstAddrMode,
                                                local_binding_list[curr_local_entry_id].dstEP, 
                                                local_binding_list[curr_local_entry_id].srcEP,
                                                ZB_AF_HA_PROFILE_ID, 
                                                ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                                                NULL,
                                                level_test_value, 0xFFFF);

    ZB_GET_OUT_BUF_DELAYED2(SendMoveToLevelCommandOnOffToBindings,curr_local_entry_id);
}

I'm simply swap the call order, where's the error?

I'm looking in all others example but i cannot found any similar situation.

Best Regards

Maurizio

Parents
  • Hi Maurizio,

    You should send the 'On' command before sending the 'Move to Level' command. If you see in the ZCL specification about the level cluster it says that:

    If a Move To Level, Move, Step or Stop command is received while the device is in its off state, i.e., the OnOff
    attribute of the On/Off cluster is equal to 0x00, the command SHALL be ignored.

    You can also use ZB_ZCL_LEVEL_CONTROL_GET_MOVE_TO_LEVEL_WITH_ON_OFF_REQ instead. The 'with on/off' commands the OnOff attribute of the On/Off cluster on the same endpoint will be set to 'On' before increasing the CurrentLevel.

    Best regards,

    Marjeris

Reply
  • Hi Maurizio,

    You should send the 'On' command before sending the 'Move to Level' command. If you see in the ZCL specification about the level cluster it says that:

    If a Move To Level, Move, Step or Stop command is received while the device is in its off state, i.e., the OnOff
    attribute of the On/Off cluster is equal to 0x00, the command SHALL be ignored.

    You can also use ZB_ZCL_LEVEL_CONTROL_GET_MOVE_TO_LEVEL_WITH_ON_OFF_REQ instead. The 'with on/off' commands the OnOff attribute of the On/Off cluster on the same endpoint will be set to 'On' before increasing the CurrentLevel.

    Best regards,

    Marjeris

Children
Related