How to implement a simple zigbee cluster that tow-way data transfer between zigbee coordinator and device?

Hi,

I want to implement a simple Zigbee cluster that can transfer bytes between zc or zd, like UART TXRX.

I found Messaging Cluster might be the one. After checking these posts below, I still do not have an idea of how to implement it in Zigbee Template example.

https://devzone.nordicsemi.com/f/nordic-q-a/74238/zigbee-messaging-cluster

https://devzone.nordicsemi.com/f/nordic-q-a/69469/question-how-to-send-payload-from-zed-to-zc/285676

https://devzone.nordicsemi.com/f/nordic-q-a/68430/question-can-i-use-zigbee-and-uart-at-the-same-time

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.0.0%2Fgroup___z_b___z_c_l___m_e_s_s_a_g_i_n_g.html

I am aware that there are some libs that seem to have been implemented.

ncs\v2.1.0\nrfxlib\zboss\production\include\zcl\zb_zcl_messaging.h

ncs\v2.1.0\nrfxlib\zboss\production\src\zcl\zcl_c_messaging.c

ncs\v2.1.0\nrfxlib\zboss\production\src\zcl\zcl_s_messaging.c

Could you guild me on how to implement it on the Template example code and use the Shell example ad zc to send and receive data from that message cluster?

many thanks

Parents
  • Hi

    In I.E. the zb_dimmable_light.h file located in <NCS_folder>\<NCS_version>\nrf\manifest-tmp\samples\zigbee\light_bulb\include\zb_dimmable_light.h there is an example on how to declare a cluster list for I.E. a dimmable light device, declaration of a cluster in general should be similar to this I believe:

    /**
     * @brief Declare cluster list for Dimmable Light device
     * @param cluster_list_name - cluster list variable name
     * @param basic_attr_list - attribute list for Basic cluster
     * @param identify_attr_list - attribute list for Identify cluster
     * @param groups_attr_list - attribute list for Groups cluster
     * @param scenes_attr_list - attribute list for Scenes cluster
     * @param on_off_attr_list - attribute list for On/Off cluster
     * @param level_control_attr_list - attribute list for Level Control cluster
     */
    #define ZB_DECLARE_DIMMABLE_LIGHT_CLUSTER_LIST(					   \
    	cluster_list_name,							   \
    	basic_attr_list,							   \
    	identify_attr_list,							   \
    	groups_attr_list,							   \
    	scenes_attr_list,							   \
    	on_off_attr_list,							   \
    	level_control_attr_list)						   \
    	zb_zcl_cluster_desc_t cluster_list_name[] =				   \
    	{									   \
    		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_SCENES,				   \
    			ZB_ZCL_ARRAY_SIZE(scenes_attr_list, zb_zcl_attr_t),	   \
    			(scenes_attr_list),					   \
    			ZB_ZCL_CLUSTER_SERVER_ROLE,				   \
    			ZB_ZCL_MANUF_CODE_INVALID				   \
    		),								   \
    		ZB_ZCL_CLUSTER_DESC(						   \
    			ZB_ZCL_CLUSTER_ID_GROUPS,				   \
    			ZB_ZCL_ARRAY_SIZE(groups_attr_list, zb_zcl_attr_t),	   \
    			(groups_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_SERVER_ROLE,				   \
    			ZB_ZCL_MANUF_CODE_INVALID				   \
    		),								   \
    		ZB_ZCL_CLUSTER_DESC(						   \
    			ZB_ZCL_CLUSTER_ID_LEVEL_CONTROL,			   \
    			ZB_ZCL_ARRAY_SIZE(level_control_attr_list, zb_zcl_attr_t), \
    			(level_control_attr_list),				   \
    			ZB_ZCL_CLUSTER_SERVER_ROLE,				   \
    			ZB_ZCL_MANUF_CODE_INVALID				   \
    		)								   \
    	}

    Best regards,

    Simon

Reply
  • Hi

    In I.E. the zb_dimmable_light.h file located in <NCS_folder>\<NCS_version>\nrf\manifest-tmp\samples\zigbee\light_bulb\include\zb_dimmable_light.h there is an example on how to declare a cluster list for I.E. a dimmable light device, declaration of a cluster in general should be similar to this I believe:

    /**
     * @brief Declare cluster list for Dimmable Light device
     * @param cluster_list_name - cluster list variable name
     * @param basic_attr_list - attribute list for Basic cluster
     * @param identify_attr_list - attribute list for Identify cluster
     * @param groups_attr_list - attribute list for Groups cluster
     * @param scenes_attr_list - attribute list for Scenes cluster
     * @param on_off_attr_list - attribute list for On/Off cluster
     * @param level_control_attr_list - attribute list for Level Control cluster
     */
    #define ZB_DECLARE_DIMMABLE_LIGHT_CLUSTER_LIST(					   \
    	cluster_list_name,							   \
    	basic_attr_list,							   \
    	identify_attr_list,							   \
    	groups_attr_list,							   \
    	scenes_attr_list,							   \
    	on_off_attr_list,							   \
    	level_control_attr_list)						   \
    	zb_zcl_cluster_desc_t cluster_list_name[] =				   \
    	{									   \
    		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_SCENES,				   \
    			ZB_ZCL_ARRAY_SIZE(scenes_attr_list, zb_zcl_attr_t),	   \
    			(scenes_attr_list),					   \
    			ZB_ZCL_CLUSTER_SERVER_ROLE,				   \
    			ZB_ZCL_MANUF_CODE_INVALID				   \
    		),								   \
    		ZB_ZCL_CLUSTER_DESC(						   \
    			ZB_ZCL_CLUSTER_ID_GROUPS,				   \
    			ZB_ZCL_ARRAY_SIZE(groups_attr_list, zb_zcl_attr_t),	   \
    			(groups_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_SERVER_ROLE,				   \
    			ZB_ZCL_MANUF_CODE_INVALID				   \
    		),								   \
    		ZB_ZCL_CLUSTER_DESC(						   \
    			ZB_ZCL_CLUSTER_ID_LEVEL_CONTROL,			   \
    			ZB_ZCL_ARRAY_SIZE(level_control_attr_list, zb_zcl_attr_t), \
    			(level_control_attr_list),				   \
    			ZB_ZCL_CLUSTER_SERVER_ROLE,				   \
    			ZB_ZCL_MANUF_CODE_INVALID				   \
    		)								   \
    	}

    Best regards,

    Simon

Children
No Data
Related