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 Reply Children
  • Hello,

    Thanks for the answer. All my code is based on the example of a Multisensor. Yes, I know about ZBOSS_DECLARE_DEVICE (more precisely ZBOSS_DEVICE_DECLARE_REPORTING_CTX) and its parameters. I declared a new ZBOSS_DEVICE_DECLARE_REPORTING_CTX at each endpoint, following the example of the endpoint in the Multisensor, but gave each one a different name (otherwise it gives an error)(reporting_info## ep_name). It seemed to me logical. Example before:

    #include "zb_zcl_analog_input.h"
    #include "zb_zcl_multistate_value.h"
    #include "zb_zcl_binary_value.h"
    #include "zb_zcl_multistate_input.h"
    
    #define ZB_DEVICE_VER                        1
    
    /* COUNTER EndPoint */
    #define ZB_COUNTER_EP                        10                  /**< Device endpoint. */
    #define ZB_COUNTER_EP_REPORT_ATTR_COUNT      4                   /**< Number of attributes mandatory for reporting in cluster. */
    #define ZB_COUNTER_EP_IN_CLUSTER_NUM         4                   /**< Number of the input (server) clusters in the multisensor device. */
    #define ZB_COUNTER_EP_OUT_CLUSTER_NUM        0                   /**< Number of the output (client) clusters in the multisensor device. */
    
    /* DUTY EndPoint */
    #define ZB_DUTY_EP                           11                  /**< Device endpoint. */
    #define ZB_DUTY_EP_REPORT_ATTR_COUNT         2                   /**< Number of attributes mandatory for reporting in cluster. */
    #define ZB_DUTY_EP_IN_CLUSTER_NUM            3                   /**< Number of the input (server) clusters in the multisensor device. */
    #define ZB_DUTY_EP_OUT_CLUSTER_NUM           0                   /**< Number of the output (client) clusters in the multisensor device. */
    
    /* LEDS EndPoint */
    #define ZB_LEDS_EP                           12                  /**< Device endpoint. */
    #define ZB_LEDS_EP_REPORT_ATTR_COUNT         4                   /**< Number of attributes mandatory for reporting in cluster. */
    #define ZB_LEDS_EP_IN_CLUSTER_NUM            5                   /**< Number of the input (server) clusters in the multisensor device. */
    #define ZB_LEDS_EP_OUT_CLUSTER_NUM           0                   /**< Number of the output (client) clusters in the multisensor device. */
    #define ZB_LEDS_EP_LIGHT_CVC_ATTR_COUNT      1
    
    
    /* -------------------------------------------- COUNTER ENDPOINT DECLARE ---------------------------------------------------------- */
    
    /** @brief Declares endpoint for the COUNTER EndPoint.
     *   
     *  @param ep_name          Endpoint variable name.
     *  @param ep_id            Endpoint ID.
     *  @param cluster_list     Endpoint cluster list.
     */
    #define ZB_DECLARE_COUNTER_EP(ep_name, ep_id, cluster_list)                           \
      ZB_DECLARE_COUNTER_DESC(ep_name,                                                    \
                              ep_id,                                                      \
                              ZB_COUNTER_EP_IN_CLUSTER_NUM,                               \
                              ZB_COUNTER_EP_OUT_CLUSTER_NUM);                             \
                                                                                          \
      ZBOSS_DEVICE_DECLARE_REPORTING_CTX(reporting_info## ep_name,                        \
                                         ZB_COUNTER_EP_REPORT_ATTR_COUNT);                \
                                                                                          \
      ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,                                                \
                                  ep_id,                                                  \
                                  ZB_AF_HA_PROFILE_ID,                                    \
                                  0,                                                      \
                                  NULL,                                                   \
                                  ZB_ZCL_ARRAY_SIZE(cluster_list, zb_zcl_cluster_desc_t), \
                                  cluster_list,                                           \
                                  (zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name,       \
                                  ZB_COUNTER_EP_REPORT_ATTR_COUNT,                        \
                                  reporting_info## ep_name,                               \
                                  0,                                                      \
                                  NULL)
    
    
    /* -------------------------------------------- DUTY ENDPOINT DECLARE ---------------------------------------------------------- */
    
    /** @brief Declares endpoint for the DUTY EndPoint.
     *   
     *  @param ep_name          Endpoint variable name.
     *  @param ep_id            Endpoint ID.
     *  @param cluster_list     Endpoint cluster list.
     */
    #define ZB_DECLARE_DUTY_EP(ep_name, ep_id, cluster_list)                              \
      ZB_DECLARE_DUTY_DESC(ep_name,                                                       \
                           ep_id,                                                         \
                           ZB_DUTY_EP_IN_CLUSTER_NUM,                                     \
                           ZB_DUTY_EP_OUT_CLUSTER_NUM);                                   \
                                                                                          \
      ZBOSS_DEVICE_DECLARE_REPORTING_CTX(reporting_info## ep_name,                        \
                                         ZB_DUTY_EP_REPORT_ATTR_COUNT);                   \
                                                                                          \
      ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,                                                \
                                  ep_id,                                                  \
                                  ZB_AF_HA_PROFILE_ID,                                    \
                                  0,                                                      \
                                  NULL,                                                   \
                                  ZB_ZCL_ARRAY_SIZE(cluster_list, zb_zcl_cluster_desc_t), \
                                  cluster_list,                                           \
                                  (zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name,       \
                                  ZB_DUTY_EP_REPORT_ATTR_COUNT,                           \
                                  reporting_info## ep_name,                               \
                                  0,                                                      \
                                  NULL)                                                   \
                                  
    
    /* -------------------------------------------- LEDS ENDPOINT DECLARE ---------------------------------------------------------- */
    
    /*!
      @brief Declare endpoint for Dimmable Light device
      @param ep_name - endpoint variable name
      @param ep_id - endpoint ID
      @param cluster_list - endpoint cluster list
     */
    #define ZB_DECLARE_LEDS_EP(ep_name, ep_id, cluster_list)                              \
      ZB_DECLARE_LEDS_SIMPLE_DESC(ep_name, ep_id,                                         \
                                  ZB_LEDS_EP_IN_CLUSTER_NUM,                              \
                                  ZB_LEDS_EP_OUT_CLUSTER_NUM);                            \
                                                                                          \
      ZBOSS_DEVICE_DECLARE_REPORTING_CTX(reporting_info## ep_name,                        \
                                         ZB_LEDS_EP_REPORT_ATTR_COUNT);                   \
                                                                                          \
      ZBOSS_DEVICE_DECLARE_LEVEL_CONTROL_CTX(cvc_alarm_info## device_ctx_name,            \
                                             ZB_LEDS_EP_LIGHT_CVC_ATTR_COUNT);            \
                                                                                          \
      ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,                                                \
                                  ep_id,                                                  \
                                  ZB_AF_HA_PROFILE_ID,                                    \
                                  0,                                                      \
                                  NULL,                                                   \
                                  ZB_ZCL_ARRAY_SIZE(cluster_list, zb_zcl_cluster_desc_t), \
                                  cluster_list,                                           \
                                  (zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name,       \
                                  ZB_LEDS_EP_REPORT_ATTR_COUNT,                           \
                                  reporting_info## ep_name,                               \
                                  ZB_LEDS_EP_LIGHT_CVC_ATTR_COUNT,                        \
                                  cvc_alarm_info## device_ctx_name)

    But now I got the idea that I need to call the macro ZBOSS_DEVICE_DECLARE_REPORTING_CTX (rep_ctx, rep_count) only at ONE endpoint (and specify the sum of all reporting attributes from all endpoints in rep_count), and in other declarations endpoints specify only the context name report (rep_ctx) in ZB_AF_DECLARE_ENDPOINT_DESC.

    In other words, the context (global variable zb_zcl_reporting_info_t rep_ctx[rep_count]) should be common to all endpoints? This is true?

    Examle now:

    #include "zb_zcl_analog_input.h"
    #include "zb_zcl_multistate_value.h"
    #include "zb_zcl_binary_value.h"
    #include "zb_zcl_multistate_input.h"
    
    #define ZB_DEVICE_VER                        1
    
    /* COUNTER EndPoint */
    #define ZB_COUNTER_EP                        10                  /**< Device endpoint. */
    #define ZB_COUNTER_EP_REPORT_ATTR_COUNT      4                   /**< Number of attributes mandatory for reporting in cluster. */
    #define ZB_COUNTER_EP_IN_CLUSTER_NUM         4                   /**< Number of the input (server) clusters in the multisensor device. */
    #define ZB_COUNTER_EP_OUT_CLUSTER_NUM        0                   /**< Number of the output (client) clusters in the multisensor device. */
    
    /* DUTY EndPoint */
    #define ZB_DUTY_EP                           11                  /**< Device endpoint. */
    #define ZB_DUTY_EP_REPORT_ATTR_COUNT         2                   /**< Number of attributes mandatory for reporting in cluster. */
    #define ZB_DUTY_EP_IN_CLUSTER_NUM            3                   /**< Number of the input (server) clusters in the multisensor device. */
    #define ZB_DUTY_EP_OUT_CLUSTER_NUM           0                   /**< Number of the output (client) clusters in the multisensor device. */
    
    /* LEDS EndPoint */
    #define ZB_LEDS_EP                           12                  /**< Device endpoint. */
    #define ZB_LEDS_EP_REPORT_ATTR_COUNT         4                   /**< Number of attributes mandatory for reporting in cluster. */
    #define ZB_LEDS_EP_IN_CLUSTER_NUM            5                   /**< Number of the input (server) clusters in the multisensor device. */
    #define ZB_LEDS_EP_OUT_CLUSTER_NUM           0                   /**< Number of the output (client) clusters in the multisensor device. */
    #define ZB_LEDS_EP_LIGHT_CVC_ATTR_COUNT      1
    
    /* -------------------------------------------- COUNTER ENDPOINT DECLARE ---------------------------------------------------------- */
    /* ---------------------------------------------- DECLARE REPORTING CTX --------------------------------------- */
    
    /** @brief Declares endpoint for the COUNTER EndPoint.
     *   
     *  @param ep_name          Endpoint variable name.
     *  @param ep_id            Endpoint ID.
     *  @param cluster_list     Endpoint cluster list.
     */
    #define ZB_DECLARE_COUNTER_EP(ep_name, ep_id, cluster_list)                           \
      ZB_DECLARE_COUNTER_DESC(ep_name,                                                    \
                              ep_id,                                                      \
                              ZB_COUNTER_EP_IN_CLUSTER_NUM,                               \
                              ZB_COUNTER_EP_OUT_CLUSTER_NUM);                             \
                                                                                          \
      ZBOSS_DEVICE_DECLARE_REPORTING_CTX(reporting_info## device_ctx_name,                \
                                         ZB_COUNTER_EP_REPORT_ATTR_COUNT + ZB_DUTY_EP_REPORT_ATTR_COUNT + ZB_LEDS_EP_REPORT_ATTR_COUNT);  \
                                                                                          \
      ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,                                                \
                                  ep_id,                                                  \
                                  ZB_AF_HA_PROFILE_ID,                                    \
                                  0,                                                      \
                                  NULL,                                                   \
                                  ZB_ZCL_ARRAY_SIZE(cluster_list, zb_zcl_cluster_desc_t), \
                                  cluster_list,                                           \
                                  (zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name,       \
                                  ZB_COUNTER_EP_REPORT_ATTR_COUNT + ZB_DUTY_EP_REPORT_ATTR_COUNT + ZB_LEDS_EP_REPORT_ATTR_COUNT,        \
                                  reporting_info## device_ctx_name,                       \
                                  0,                                                      \
                                  NULL)
    
    
    /* -------------------------------------------- DUTY ENDPOINT DECLARE  ---------------------------------------------------------- */
    /* -------------------------------- NOT ZBOSS_DEVICE_DECLARE_REPORTING_CTX -------------------------------- */
    
    /** @brief Declares endpoint for the DUTY EndPoint.
     *   
     *  @param ep_name          Endpoint variable name.
     *  @param ep_id            Endpoint ID.
     *  @param cluster_list     Endpoint cluster list.
     */
    #define ZB_DECLARE_DUTY_EP(ep_name, ep_id, cluster_list)                              \
      ZB_DECLARE_DUTY_DESC(ep_name,                                                       \
                           ep_id,                                                         \
                           ZB_DUTY_EP_IN_CLUSTER_NUM,                                     \
                           ZB_DUTY_EP_OUT_CLUSTER_NUM);                                   \
                                                                                          \
      ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,                                                \
                                  ep_id,                                                  \
                                  ZB_AF_HA_PROFILE_ID,                                    \
                                  0,                                                      \
                                  NULL,                                                   \
                                  ZB_ZCL_ARRAY_SIZE(cluster_list, zb_zcl_cluster_desc_t), \
                                  cluster_list,                                           \
                                  (zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name,       \
                                  ZB_COUNTER_EP_REPORT_ATTR_COUNT + ZB_DUTY_EP_REPORT_ATTR_COUNT + ZB_LEDS_EP_REPORT_ATTR_COUNT,   \
                                  reporting_info## device_ctx_name,                       \
                                  0,                                                      \
                                  NULL)                                                   \
                                  
    
    /* -------------------------------------------- LEDS ENDPOINT DECLARE ---------------------------------------------------------- */
    /* -------------------------------- NOT ZBOSS_DEVICE_DECLARE_REPORTING_CTX -------------------------------- */
    
    
    /*!
      @brief Declare endpoint for Dimmable Light device
      @param ep_name - endpoint variable name
      @param ep_id - endpoint ID
      @param cluster_list - endpoint cluster list
     */
    #define ZB_DECLARE_LEDS_EP(ep_name, ep_id, cluster_list)                              \
      ZB_DECLARE_LEDS_SIMPLE_DESC(ep_name, ep_id,                                         \
                                  ZB_LEDS_EP_IN_CLUSTER_NUM,                              \
                                  ZB_LEDS_EP_OUT_CLUSTER_NUM);                            \
                                                                                          \
      ZBOSS_DEVICE_DECLARE_LEVEL_CONTROL_CTX(cvc_alarm_info## device_ctx_name,            \
                                             ZB_LEDS_EP_LIGHT_CVC_ATTR_COUNT);            \
                                                                                          \
      ZB_AF_DECLARE_ENDPOINT_DESC(ep_name,                                                \
                                  ep_id,                                                  \
                                  ZB_AF_HA_PROFILE_ID,                                    \
                                  0,                                                      \
                                  NULL,                                                   \
                                  ZB_ZCL_ARRAY_SIZE(cluster_list, zb_zcl_cluster_desc_t), \
                                  cluster_list,                                           \
                                  (zb_af_simple_desc_1_1_t*)&simple_desc_##ep_name,       \
                                  ZB_COUNTER_EP_REPORT_ATTR_COUNT + ZB_DUTY_EP_REPORT_ATTR_COUNT + ZB_LEDS_EP_REPORT_ATTR_COUNT,   \
                                  reporting_info## device_ctx_name,                       \
                                  ZB_LEDS_EP_LIGHT_CVC_ATTR_COUNT,                        \
                                  cvc_alarm_info## device_ctx_name)

Related