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

Zigbee reporting not work while using multiple endpoints

Hello,

I just started to understand Zigbee and I had some problem. I created 3 endpoints. In one of them (endpoint counter_ep) I need a attribute reporting. A reporting works well only if this endpoint is the last in the list of macro parameters ZBOSS_DECLARE_DEVICE_CTX_3_EP or the only one in the macro ZBOSS_DECLARE_DEVICE_CTX_1_EP, otherwise reports will be unstable (for example, only 1 out of 10 reports will be received). Please tell me what could be the problem. I already found a similar problem on your forum, but the question has been deleted.

Thanks in advance.

I am using nrf52840 chip, SDK 4.0.0, router.
Coordinator: nrf52840, SDK 4.0.0, CLI example.

Examples:
counter_ep - endpoint with report.

Works:

ZBOSS_DECLARE_DEVICE_CTX_3_EP (counter_ctx, duty_ep, leds_ep, counter_ep);

or
ZBOSS_DECLARE_DEVICE_CTX_1_EP (counter_ctx, counter_ep);

Does not work:

ZBOSS_DECLARE_DEVICE_CTX_3_EP (counter_ctx, counter_ep, duty_ep, leds_ep);

or
ZBOSS_DECLARE_DEVICE_CTX_3_EP (counter_ctx, duty_ep counter_ep, leds_ep);

or
ZBOSS_DECLARE_DEVICE_CTX_2_EP (counter_ctx, counter_ep, leds_ep);

or
ZBOSS_DECLARE_DEVICE_CTX_2_EP (counter_ctx, counter_ep, duty_ep);

Parents
  • Hi

    Sorry, but it seems like you're struggling to update your values, not declaring them. Is that right? You're explaining very well how you're declaring your attribute values, but not how you're updating them. In the multisensor example, they are updated by using the zb_zcl_set_attr_val function, which I can't see anywhere in your snippets. So how are you doing the attribute reporting itself?

    By the way. If you have an extra nRF52840DK or nRF52 Dongle, you can use one of those as a sniffer with the nRFSniffer in order to capture packets and make a sniffer trace in Wireshark.

    Best regards,

    Simon

Reply
  • Hi

    Sorry, but it seems like you're struggling to update your values, not declaring them. Is that right? You're explaining very well how you're declaring your attribute values, but not how you're updating them. In the multisensor example, they are updated by using the zb_zcl_set_attr_val function, which I can't see anywhere in your snippets. So how are you doing the attribute reporting itself?

    By the way. If you have an extra nRF52840DK or nRF52 Dongle, you can use one of those as a sniffer with the nRFSniffer in order to capture packets and make a sniffer trace in Wireshark.

    Best regards,

    Simon

Children
  • Hello,

    Of course, I not only declare attribute values, but also update them. Otherwise, how would I see that only 1 out of 10 packets comes to the coordinator? :)

    It just seemed to me that this is not so important for this issue. Here is an example of several functions by which I update some attributes from different endpoints and this works:

    /** @brief Function for update COUNTER VALUE cluster attributes */
    static void update_counter_value(zb_uint32_t new_value)
    {
        if (!system_param.connected) return;
    
        zb_zcl_status_t zcl_status = zb_zcl_set_attr_val(ZB_COUNTER_EP, 
                                                         ZB_ZCL_CLUSTER_ID_ANALOG_INPUT, 
                                                         ZB_ZCL_CLUSTER_SERVER_ROLE, 
                                                         ZB_ZCL_ATTR_ANALOG_INPUT_PRESENT_VALUE_ID, 
                                                         (zb_uint8_t *)&new_value,
                                                         ZB_FALSE);
    
        if (zcl_status == ZB_ZCL_STATUS_SUCCESS) { NRF_LOG_INFO("Set new value in COUNTER VALUE success! Value: %ld", (uint32_t)new_value);       }
        else                                     { NRF_LOG_INFO("Set new value in COUNTER VALUE is fail. zcl_status: %d", zcl_status); }
    }
    
    /** @brief Function for update DUTY TIME_LIVE_IN_HOUR cluster attributes */
    static void update_duty_time_live_in_hour(zb_uint16_t new_value)
    {
        if (!system_param.connected) return;
    
        zb_zcl_status_t zcl_status = zb_zcl_set_attr_val(ZB_DUTY_EP, 
                                                         ZB_ZCL_CLUSTER_ID_MULTI_INPUT, 
                                                         ZB_ZCL_CLUSTER_SERVER_ROLE, 
                                                         ZB_ZCL_ATTR_MULTI_INPUT_PRESENT_VALUE_ID, 
                                                         (zb_uint8_t *)&new_value,
                                                         ZB_FALSE);
    
        if (zcl_status == ZB_ZCL_STATUS_SUCCESS) { NRF_LOG_INFO("Set new value in DUTY TIME_LIVE_IN_HOUR success! Value: %d", new_value);       }
        else                                     { NRF_LOG_INFO("Set new value in DUTY TIME_LIVE_IN_HOUR is fail. zcl_status: %d", zcl_status); }
      
    }
    
    /** @brief Function for update LEDS INVERSION cluster attributes */
    static void update_leds_inversion(zb_bool_t new_value)
    {
        if (!system_param.connected) return;
    
        zb_zcl_status_t zcl_status = zb_zcl_set_attr_val(ZB_LEDS_EP, 
                                                         ZB_ZCL_CLUSTER_ID_BINARY_VALUE, 
                                                         ZB_ZCL_CLUSTER_SERVER_ROLE, 
                                                         ZB_ZCL_ATTR_BINARY_VALUE_PRESENT_VALUE_ID, 
                                                         (zb_uint8_t *)&new_value,
                                                         ZB_FALSE);
    
        if (zcl_status == ZB_ZCL_STATUS_SUCCESS) { NRF_LOG_INFO("Set new value in LEDS INVERSION success! Value: %d", new_value);       }
        else                                     { NRF_LOG_INFO("Set new value in LEDS INVERSION is fail. zcl_status: %d", zcl_status); }
      
    }
    
    /** @brief Function for update LEDS LEVEL cluster attributes */
    static void update_leds_level_control(zb_uint16_t new_value)
    {
        if (!system_param.connected) return;
    
        zb_zcl_status_t zcl_status;
        NRF_LOG_INFO("Set level value: %i", new_value);
    
        zcl_status = zb_zcl_set_attr_val(ZB_LEDS_EP,                                       
                                         ZB_ZCL_CLUSTER_ID_LEVEL_CONTROL,            
                                         ZB_ZCL_CLUSTER_SERVER_ROLE,                 
                                         ZB_ZCL_ATTR_LEVEL_CONTROL_CURRENT_LEVEL_ID, 
                                         (zb_uint8_t *)&new_value,                                       
                                         ZB_FALSE);                                  
     
        if (zcl_status == ZB_ZCL_STATUS_SUCCESS) { NRF_LOG_INFO("Set new value in LEDS LEVEL success! Value: %d", new_value);               }
        else                                     { NRF_LOG_INFO("Set new value in LEDS LEVEL is fail. zcl_status: %d", zcl_status); return; }
    
        /* According to the table 7.3 of Home Automation Profile Specification v 1.2 rev 29, chapter 7.1.3. */
        if (new_value == 0)
        {
            zb_uint8_t value = ZB_FALSE;
            zcl_status = zb_zcl_set_attr_val(ZB_LEDS_EP, 
                                             ZB_ZCL_CLUSTER_ID_ON_OFF,    
                                             ZB_ZCL_CLUSTER_SERVER_ROLE,  
                                             ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID,
                                             &value,                        
                                             ZB_FALSE);
    
            if (zcl_status == ZB_ZCL_STATUS_SUCCESS) { NRF_LOG_INFO("Set new value in LEDS ON_OFF success! Value: %d", new_value);       }
            else                                     { NRF_LOG_INFO("Set new value in LEDS ON_OFF is fail. zcl_status: %d", zcl_status); }        
        }
        else
        {
            zb_uint8_t value = ZB_TRUE;
            zcl_status = zb_zcl_set_attr_val(ZB_LEDS_EP, 
                                            ZB_ZCL_CLUSTER_ID_ON_OFF,    
                                            ZB_ZCL_CLUSTER_SERVER_ROLE,  
                                            ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID,
                                            &value,                        
                                            ZB_FALSE);
    
            if (zcl_status == ZB_ZCL_STATUS_SUCCESS) { NRF_LOG_INFO("Set new value in LEDS ON_OFF success! Value: %d", new_value);       }
            else                                     { NRF_LOG_INFO("Set new value in LEDS ON_OFF is fail. zcl_status: %d", zcl_status); }
    
        }
    }
    
    /** @brief Function for update LEDS ON_OFF cluster attributes */
    static void update_leds_on_off(zb_bool_t new_value)
    {
        if (!system_param.connected) return;
        
        NRF_LOG_INFO("Set ON/OFF value: %i", new_value);
    
        zb_zcl_status_t zcl_status = zb_zcl_set_attr_val(ZB_LEDS_EP, 
                                                         ZB_ZCL_CLUSTER_ID_ON_OFF,    
                                                         ZB_ZCL_CLUSTER_SERVER_ROLE,  
                                                         ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID,
                                                         (zb_uint8_t *)&new_value,                        
                                                         ZB_FALSE);
    
        if (zcl_status == ZB_ZCL_STATUS_SUCCESS) { NRF_LOG_INFO("Set new value in LEDS ON_OFF success! Value: %d", new_value);               }
        else                                     { NRF_LOG_INFO("Set new value in LEDS ON_OFF is fail. zcl_status: %d", zcl_status); return; }
    
        if (new_value)
        {
            update_leds_level_control(m_dev_ctx.leds_level_control.current_level);
        }
    }

    And on the CLI-coordinator I send the following commands in the terminal (example for a only one attribute in counter_ep):

    bdb role zc

    bdb start

    zdo match_desc 0xffff 0xffff 0x0104 2 0x000c 0x0014 0

    zdo bind on (full_addr ZR) 10 (full_addr ZC) 64 0x000c (short_addr ZR from the response to the previous command)

    And reporting attributes begin to come to the terminal.

    P.S. Thank you, I know about your sniffer and it really works well, I just did not have extra DK.

Related