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

Problem with Cluster global attributes, in particular "ClusterRevision attribute" [URGENT]

Hello to all,

I have a problem related to the client side Global Attribute: I have implemented an "On / Off Switch" that presents the cluster On / Off (0x0006), client side. I'm using the nRF SDK for Zigbee and Thread 3.0.0.

From specification it is said that the Cluster Global Attribute, and in particular the ClusterRevision attribute, is mandatory, both on the client side and on the server side (cfr. ZigBee Cluster Library Specification 2.3.5.1: "The ClusterRevision global attribute is mandatory for all cluster instances, client and server, conforming to
ZCL revision 6 (ZCL6) and later ZCL revisions.").

At the moment, however, if I send a "Read Attribute" or "Write Attribute" command of this attribute, which has ID 0xFFFD, the On / Off Switch device replies with the error code 134 and, if I go to see with the sniffer the message, the device replies with "unsupported cluster".


On the server side, this problem does not exist, also because by checking the code, on the needed side the macro for the attribute list is called which in turn contains the macro "ZB_ZCL_START_DECLARE_ATTRIB_LIST (attr_list)" which calls the Global Attribute.

#define ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST_EXT(                                                  \
    attr_list, on_off, global_scene_ctrl, on_time, off_wait_time                                \
    )                                                                                           \
    ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list)                                                 \
    ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, (on_off))                                \
    ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_GLOBAL_SCENE_CONTROL, (global_scene_ctrl))          \
    ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_TIME, (on_time))                                 \
    ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_OFF_WAIT_TIME, (off_wait_time))                     \
    ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST

By not calling this macro for cluster 0x0006 client side, how do I activate this particular attribute?


Thank you very much for helping.

BR,

Raffaela

Parents
  • Hello to all,

    I would like to complete the post based on the tests I did: changing the code of the "zb_ha_on_off_switch.h" file and inserting the call to the attribute list, then the ClusterRevision is seen and the device responds correctly to the request to read the cluster.

    So I would say that the problem is that this attribute is not currently present in the "On / Off Switch" device.

    I don't know if this can help to understand how I have to intervene to have the attribute also on the client side; I also attach the code of the file "zb_ha_on_off_switch.h".

    /* ZBOSS Zigbee 3.0
     *
     * Copyright (c) 2012-2018 DSR Corporation, Denver CO, USA.
     * http://www.dsr-zboss.com
     * http://www.dsr-corporation.com
     * All rights reserved.
     *
     *
     * Use in source and binary forms, redistribution in binary form only, with
     * or without modification, are permitted provided that the following conditions
     * are met:
     *
     * 1. Redistributions in binary form, except as embedded into a Nordic
     *    Semiconductor ASA integrated circuit in a product or a software update for
     *    such product, must reproduce the above copyright notice, this list of
     *    conditions and the following disclaimer in the documentation and/or other
     *    materials provided with the distribution.
     *
     * 2. Neither the name of Nordic Semiconductor ASA nor the names of its
     *    contributors may be used to endorse or promote products derived from this
     *    software without specific prior written permission.
     *
     * 3. This software, with or without modification, must only be used with a Nordic
     *    Semiconductor ASA integrated circuit.
     *
     * 4. Any software provided in binary form under this license must not be reverse
     *    engineered, decompiled, modified and/or disassembled.
     *
     * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR
     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE
     * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
     * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    PURPOSE: On/off switch device definition
    */
    #ifndef ZB_HA_ON_OFF_SWITCH_H
    #define ZB_HA_ON_OFF_SWITCH_H 1
    
    /**
     *  @defgroup ha_on_off_switch On/Off Switch
     *  @ingroup ZB_HA_DEVICES
        @{
        @details
        On Off Switch device has 6 clusters (see spec 7.4.1): \n
            - @ref ZB_ZCL_IDENTIFY \n
            - @ref ZB_ZCL_BASIC \n
            - @ref ZB_ZCL_OOSC \n
            - @ref ZB_ZCL_ON_OFF \n
            - @ref ZB_ZCL_SCENES \n
            - @ref ZB_ZCL_GROUPS
    
        On Off Switch device sample
    
        @par Example
        Declaring clusters
        @snippet ha_on_off_switch_sample.c COMMON_DECLARATION
        Registering device list
        @snippet ha_on_off_switch_sample.c REGISTER
        Example of command handler
        @snippet ha_on_off_switch_sample.c VARIABLE
        @snippet ha_on_off_switch_sample.c HANDLER
        @par
    
        See ha/devices_generic sample
    */
    
    /** @cond internals_doc */
    #define ZB_HA_DEVICE_VER_ON_OFF_SWITCH 0  /*!< On/Off Switch device version */
    
    #define ZB_HA_ON_OFF_SWITCH_IN_CLUSTER_NUM 3  /*!< On/Off switch IN clusters number */
    #define ZB_HA_ON_OFF_SWITCH_OUT_CLUSTER_NUM 4 /*!< On/Off switch OUT clusters number */
    
    #define ZB_HA_ON_OFF_SWITCH_CLUSTER_NUM                                      \
      (ZB_HA_ON_OFF_SWITCH_IN_CLUSTER_NUM + ZB_HA_ON_OFF_SWITCH_OUT_CLUSTER_NUM)
    
    /*! Number of attribute for reporting on On/Off switch device */
    #define ZB_HA_ON_OFF_SWITCH_REPORT_ATTR_COUNT \
      (ZB_ZCL_ON_OFF_SWITCH_CONFIG_REPORT_ATTR_COUNT)
    
    /** @endcond */
    
    /** @brief Declare cluster list for On/Off switch device
        @param cluster_list_name - cluster list variable name
        @param on_off_switch_config_attr_list - attribute list for On/off switch configuration cluster
        @param basic_attr_list - attribute list for Basic cluster
        @param identify_attr_list - attribute list for Identify cluster
     */
    #define ZB_HA_DECLARE_ON_OFF_SWITCH_CLUSTER_LIST(                           \
          cluster_list_name,                                                    \
          on_off_attr_list,                                                     \
          on_off_switch_config_attr_list,                                       \
          basic_attr_list,                                                      \
          identify_attr_list)                                                   \
          zb_zcl_cluster_desc_t cluster_list_name[] =                           \
          {                                                                     \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_ON_OFF_SWITCH_CONFIG,                           \
              ZB_ZCL_ARRAY_SIZE(on_off_switch_config_attr_list, zb_zcl_attr_t), \
              (on_off_switch_config_attr_list),                                 \
              ZB_ZCL_CLUSTER_SERVER_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_IDENTIFY,                                       \
              ZB_ZCL_ARRAY_SIZE(identify_attr_list, zb_zcl_attr_t),             \
              (identify_attr_list),                                             \
              ZB_ZCL_CLUSTER_SERVER_ROLE,                                        \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_BASIC,                                          \
              ZB_ZCL_ARRAY_SIZE(basic_attr_list, zb_zcl_attr_t),                \
              (basic_attr_list),                                                \
              ZB_ZCL_CLUSTER_SERVER_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_ON_OFF,                                         \
              ZB_ZCL_ARRAY_SIZE(on_off_attr_list, zb_zcl_attr_t),               \
              (on_off_attr_list),                                               \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_SCENES,                                         \
              0,                                                                \
              NULL,                                                             \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                            \
              ZB_ZCL_CLUSTER_ID_IDENTIFY,                                       \
              0,                                                                \
              NULL,                                                             \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                              \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_GROUPS,                                         \
              0,                                                                \
              NULL,                                                             \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            )                                                                   \
        }
    
    
    /** @cond internals_doc */
    /** @brief Declare simple descriptor for On/Off switch device
        @param ep_name - endpoint variable name
        @param ep_id - endpoint ID
        @param in_clust_num - number of supported input clusters
        @param out_clust_num - number of supported output clusters
        @note in_clust_num, out_clust_num should be defined by numeric constants, not variables or any
        definitions, because these values are used to form simple descriptor type name
    */
    #define ZB_ZCL_DECLARE_ON_OFF_SWITCH_SIMPLE_DESC(ep_name, ep_id, in_clust_num, out_clust_num) \
      ZB_DECLARE_SIMPLE_DESC(in_clust_num, out_clust_num);                                        \
      ZB_AF_SIMPLE_DESC_TYPE(in_clust_num, out_clust_num) simple_desc_##ep_name =                 \
      {                                                                                           \
        ep_id,                                                                                    \
        ZB_AF_HA_PROFILE_ID,                                                                      \
        ZB_HA_ON_OFF_SWITCH_DEVICE_ID,                                                            \
        ZB_HA_DEVICE_VER_ON_OFF_SWITCH,                                                           \
        0,                                                                                        \
        in_clust_num,                                                                             \
        out_clust_num,                                                                            \
        {                                                                                         \
          ZB_ZCL_CLUSTER_ID_BASIC,                                                                \
          ZB_ZCL_CLUSTER_ID_IDENTIFY,                                                             \
          ZB_ZCL_CLUSTER_ID_ON_OFF_SWITCH_CONFIG,                                                 \
          ZB_ZCL_CLUSTER_ID_ON_OFF,                                                               \
          ZB_ZCL_CLUSTER_ID_SCENES,                                                               \
          ZB_ZCL_CLUSTER_ID_GROUPS,                                         \
          ZB_ZCL_CLUSTER_ID_IDENTIFY,                                       \
        }                                                                                         \
      }
    
    /** @endcond */
    
    /** @brief Declare endpoint for On/off Switch device
        @param ep_name - endpoint variable name
        @param ep_id - endpoint ID
        @param cluster_list - endpoint cluster list
     */
    #define ZB_HA_DECLARE_ON_OFF_SWITCH_EP(ep_name, ep_id, cluster_list) \
      ZB_ZCL_DECLARE_ON_OFF_SWITCH_SIMPLE_DESC(                          \
          ep_name,                                                       \
          ep_id,                                                         \
          ZB_HA_ON_OFF_SWITCH_IN_CLUSTER_NUM,                            \
          ZB_HA_ON_OFF_SWITCH_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,              \
          0, NULL, /* No reporting ctx */                                \
          0, NULL) /* No CVC ctx */
    
    /** @brief Declare On/Off Switch device context.
        @param device_ctx - device context variable name.
        @param ep_name - endpoint variable name.
    */
    #define ZB_HA_DECLARE_ON_OFF_SWITCH_CTX(device_ctx, ep_name) \
      ZBOSS_DECLARE_DEVICE_CTX_1_EP(device_ctx, ep_name)
    
    
    /*! @} */
    
    #endif /* ZB_HA_ON_OFF_SWITCH_H */
    

    I attend your answer and thank you a lot for your time.

    BR,

    Raffaela

  • Hi to everyone,

    I found that this problem is known and there is a workaround how to resolve this issue but I don't understand where insert this code: is it possible to have a example?

    I attached the part that I found:

    - ZCL: There is an issue with reading GLOBAL_CLUSTER_REVISION (0xfffd) attribute on the clusters that do not have list of attributes. Read Attributes Response command will
                         contain UNSUPPORTED_ATTRIBUTE status for such type of clusters. Possible workaround: declare empty attribute list for this cluster and pass it into the cluster list
                         declaration (instead of 0-NULL declaration):
                         #define ZB_ZCL_DECLARE_EMPTY_ATTRIB_LIST(attr_list)  \  
                                 ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list)  \
                                 ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST

    Thank you for your help.

    BR,
    Raffaela
  • Hi Edvin,

    I found this in the release note of SDK 3.0.0 for Zigbee. That was present in the infocenter, in the introduction, and in the SDK.

    Thank you,

    Raffaela

  • Hi Edvin,


    I have implemented a possible wordkaround for the ClusterRevision problem on clusters that are client side and therefore do not have the macro "ZB_ZCL_START_DECLARE_ATTRIB_LIST (attr_list)". I am attaching the code I modified to get feedback and if I am actually following the right path in order to show the reading of this cluster.
    Specifically, I am implementing an "On / Off Switch" device so I modified "zb_ha_on_off_switch.h" and "zb_zcl_on_off.h".

    From "zb_ha_on_off_switch.h"

    #define ZB_HA_DECLARE_ON_OFF_SWITCH_CLUSTER_LIST(                           \
          cluster_list_name,                                                    \
          on_off_attr_list,                                                     \
          on_off_switch_config_attr_list,                                       \
          basic_attr_list,                                                      \
          identify_attr_list)                                                   \
          zb_zcl_cluster_desc_t cluster_list_name[] =                           \
          {                                                                     \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_ON_OFF_SWITCH_CONFIG,                           \
              ZB_ZCL_ARRAY_SIZE(on_off_switch_config_attr_list, zb_zcl_attr_t), \
              (on_off_switch_config_attr_list),                                 \
              ZB_ZCL_CLUSTER_SERVER_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_IDENTIFY,                                       \
              ZB_ZCL_ARRAY_SIZE(identify_attr_list, zb_zcl_attr_t),             \
              (identify_attr_list),                                             \
              ZB_ZCL_CLUSTER_SERVER_ROLE,                                        \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_BASIC,                                          \
              ZB_ZCL_ARRAY_SIZE(basic_attr_list, zb_zcl_attr_t),                \
              (basic_attr_list),                                                \
              ZB_ZCL_CLUSTER_SERVER_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_ON_OFF,                                         \
              ZB_ZCL_ARRAY_SIZE(on_off_attr_list, zb_zcl_attr_t),               \
              (on_off_attr_list),                                               \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_SCENES,                                         \
              0,                                                                \
              NULL,                                                             \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                                  \
            ZB_ZCL_CLUSTER_DESC(                                            \
              ZB_ZCL_CLUSTER_ID_IDENTIFY,                                       \
              0,                                                                \
              NULL,                                                             \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            ),                                                              \
            ZB_ZCL_CLUSTER_DESC(                                                \
              ZB_ZCL_CLUSTER_ID_GROUPS,                                         \
              0,                                                                \
              NULL,                                                             \
              ZB_ZCL_CLUSTER_CLIENT_ROLE,                                       \
              ZB_ZCL_MANUF_CODE_INVALID                                         \
            )                                                                   \
        }
    
    

    From "zb_ha_on_off_switch.h"

    /** @brief Declare attribute list for On/Off cluster
        @param attr_list - attribure list name
        @param on_off - pointer to variable to store On/Off attribute value
    */
    #define ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(attr_list, on_off)            \
      ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list)                           \
      ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, (on_off))          \
      ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
    
    #define ZB_ZCL_DECLARE_EMPTY_ATTRIB_LIST(attr_list)  \ 
            ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list)  \
            ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
    

    If you need more informations, ask me.

    Thank you and best regards,

    Raffaela

  • Hi Edvin,

    Have you any news about this topic?

    Thank you,

    Raffaela

  • Hello,

    Sorry for the late reply. I wanted someone from our Zigbee team to have a look. He said that this approach looks good. He also did some tests himself, and this is what he did:

    Changes to main.c (light switch example):

    -Added define so I can declare an empty attribute list.

    -Pass declared empty attribute list to the ZB_HA_DECLARE_DIMMER_SWITCH_CLUSTER_LIST (which has been modified to take my empty attr list).

    #define ZB_ZCL_DECLARE_EMPTY_ATTRIB_LIST(attr_list)     \
                ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list) \
                ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
    
     
    
    ZB_ZCL_DECLARE_EMPTY_ATTRIB_LIST(on_off_empty_attr_list);
    
     
    
    /* Declare cluster list for Dimmer Switch device (Identify, Basic, Scenes, Groups, On Off, Level Control). */
    /* Only clusters Identify and Basic have attributes. */
    ZB_HA_DECLARE_DIMMER_SWITCH_CLUSTER_LIST(dimmer_switch_clusters,
                                             basic_attr_list,
                                             identify_attr_list,
                                             on_off_empty_attr_list);

    So, zb_ha_dimmer_switch.h:

    -changed macro so that it takes one additional argument.

    -added an empty attr list to on_off_cluster_desc

    #define ZB_HA_DECLARE_DIMMER_SWITCH_CLUSTER_LIST(                   \
     cluster_list_name,                                                 \
     basic_attr_list,                                                   \
     identify_attr_list,                                                \
     on_off_empty_attr_list)                                            \
     
    ...
    
    
    ZB_ZCL_CLUSTER_DESC(                                                \
     ZB_ZCL_CLUSTER_ID_ON_OFF,                                          \
     ZB_ZCL_ARRAY_SIZE(on_off_empty_attr_list, zb_zcl_attr_t),          \
     (on_off_empty_attr_list),                                          \
     ZB_ZCL_CLUSTER_CLIENT_ROLE,                                        \
     ZB_ZCL_MANUF_CODE_INVALID                                          \
     ), 

  • Hi Edvin,

    Perfect!!! I implement this approach.

    Thank you a lot for your time!

    Have a good day,

    Raffaela

Reply Children
No Data
Related