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

I want to create 2 endpoints on the same zigbee device.

I want to create two switch EP(if it is possible I would like to it as much switches as possible).

I am using WIndows 10 with Segger and nRF COnnect SDK v1.5.0.

I tried it in the following way(I tried other many ways but seems that defining the same macro is conflicting):

zb_zcl_basic_attrs_ext_t         basic_attr;

ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST_EXT(
	basic_attr_list,
	&basic_attr.zcl_version,
	&basic_attr.app_version,
	&basic_attr.stack_version,
	&basic_attr.hw_version,
	basic_attr.mf_name,
	basic_attr.model_id,
	basic_attr.date_code,
	&basic_attr.power_source,
	basic_attr.location_id,
	&basic_attr.ph_env,
	basic_attr.sw_ver);

/* Declare attribute list for Identify cluster. */
ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(identify_attr_list, &attr_identify_time);

/* 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);

/* Declare endpoint for Dimmer Switch device. */
ZB_HA_DECLARE_DIMMER_SWITCH_EP(dimmer_switch_ep,
			       LIGHT_SWITCH_ENDPOINT,
			       dimmer_switch_clusters);

ZB_HA_DECLARE_DIMMER_SWITCH_EP(dimmer_switch_ep_snd,
			       LIGHT_SWITCH_ENDPOINT_SND,
			       dimmer_switch_clusters);

/* Declare application's device context (list of registered endpoints)
 * for Dimmer Switch device.
 */
#ifndef CONFIG_ZIGBEE_FOTA
//ZBOSS_DECLARE_DEVICE_CTX_1_EP(dimmer_switch_ctx, dimmer_switch_ep);
ZBOSS_DECLARE_DEVICE_CTX_2_EP(dimmer_switch_ctx, dimmer_switch_ep, dimmer_switch_ep_snd);
#else

I get the following error:

Do I have to create different atributes/clusters to each end point?

What way would be the best to do it?

Also I would like the best approach to send and receive data(integers, arrays, etc) over zigbee. Specially receive.

Parents Reply Children
  • Hm, then where is the redefinition? (the one with the crosses?) Can I reproduce this? Is it possible for me to reproduce this? Can you zip the project folder so that I can unzip it in an unmodified SDK (please test that you get the same behavior in an unmodified SDK, and that all the files you need are included in the zip folder).

    BR,
    Edvin

  • 7652.light_switch.zip

    There you have. The sketch is a bit messy because I tried many things. From line 193 you will find the declarations of the endpoints.

    Thank you!

  • Hello,

    Ok, I see. So you want to create two endpoints with the light switch. I assume this is because you want to send light switch commands to two separate groups, is that correct?

    I see that the compiler error isn't related to the ZBOSS_DECLARE_DEVICE_CTX_2_EP, because it still occurs if I comment it out and use the 

    ZBOSS_DECLARE_DEVICE_CTX_1_EP instead. The issue is that you are using two calls to ZB_HA_DECLARE_DIMMER_SWITCH_EP(). Inside this, it uses:
    ZB_ZCL_DECLARE_DIMMER_SWITCH_SIMPLE_DESC() -> ZB_DECLARE_SIMPLE_DESC(), and the latter doesn't consider any names, only the in_clust_num and the out_clost_num. This means you can't use this two times with two instances of the same number of input and output clusters. 
    Can you please try to add the attached file to your project (Just copy it into the "include" folder together with nus_cmd.h and zb_mem_config_custom.h", and add it to main using '#include "zigbee_dimmable_light_switch.h" '.
    Then replace the calls to ZB_HA_DECLARE_DIMMER_SWITCH_EP() with ZB_ZCL_DECLARE_DIMMER_SWITCH_EP() in your main.c file. In my case, that made it compile, at least.
    If the intention is to control two different light bulb groups, you don't necessarily need two light switch endpoints. You can acheive the same sending the command to two different groups.
    Best regards,
    Edvin
  • Hello

    Okay I get it!

    I don't see any attached file(If you mean to your answer).

    My intention is to add multiple buttons to zigbee2mqtt from the same board, I don't if I can make it in some hacky way with groups I will try for sure to avoid problems.

    I also would like to add a sensor device(more than one if it is possible) to this to send different kind of values. Would it be possible? Any advise?

    Then I would like to make this device able to receive data from the gateway. What kind of device would be recommended? I saw some of them that could be useful in the specs but I am not sure.

    Thanks a lot for your answers

    Best regards,

    Manue

  • Hi Manue,

    Edvin will be out of office for some time, so I will help with this case.

    I assume the file he meant to add is this one:

    zigbee_dimmable_light_switch.h

    ManuCorrea said:
    I also would like to add a sensor device

    Knowing a bit more about what your goal is with the sensors will help with what advise I can give. Are you thinking of adding sensors as different Zigbee devices (or boards), or are you planning to implement all of this on the same device, the one you have implemented two switch endpoint on? How to implement this will also depend on the type of sensor device. For example, there is a cluster specifically for temperature measurements, so if that is what you want you can use that cluster library. I would recommend looking at what cluster libraries are available to see if you can use any of them in your application. The cluster libraries that are implemented in NCS v1.5.0 and their API can be found here. You can also check out the Zigbee Cluster Library specification.

    ManuCorrea said:
    Then I would like to make this device able to receive data from the gateway.

    I do not have much experience with zigbee2mqtt, but from what I can tell the gateway functions as the Zigbee coordinator. As they are both Zigbee devices you should be able to receive messages from the gateway to your device, but I do not know the gateway is implemented or what clusters it uses. What kind of data do you want to receive from the gateway, and do you know whether the gateway already has the functionality or cluster for this, or is it possible to implement it on the gateway?

    ManuCorrea said:
    What kind of device would be recommended?

     I am not sure if I understood what you meant by this. Do you mean what kind of cluster would be recommended, or something else?

    Best regards,

    Marte

Related