This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC26X2R1: Occupancy sensor + light bulb

Part Number: LAUNCHXL-CC26X2R1
Other Parts Discussed in Thread: Z-STACK

Hello everyone, I have a LAUNCHXL-CC26X2R1 acting as a coordinator, an OSRAM light bulb an d6t-8l temperature sensor which I want to use as a ocupancy sensor and uses I2C to connect to the coordinator. I started with the project Zigbee Coordinator Switch and I am able to toggle the light from the CUI. Then, I added the temperature sensor code to the project and created a new option in the menu. So by now, I am able to read the temperature from the sensor too.

The next step is to toggle the light automatically depending on the output of the temperature sensor. Can be done with this setup? I do not know if I just can add the cluster options for the temperature sensor and it will work or I need to change this setup or add another launchpad... The temperature sensor can be used as a zed device even when is connected with I2C, right?

I am following "Designing a Custom Zigbee 3.0-Certifiable Product Using SampleApp" but I want to be sure if temperature sensor + light bulb can be connected with a coordinator and make it work.

Thank you.

  • I should be no problem to read temperature sensor and send on/off/toggle command from switch by using temperature data. However, this should be implemented in your application by yourself.

  • I am taking a look at this document, Occupancy Sensor Device Specification. When you say this should be implemented in my application by myself means that can be done without it or that I have to integrate one of this device descriptions? Just to be sure.

    Thank you.

  • What do you mean “that can be done without it or that I have to integrate one of this device descriptions?”

  • Sorry, I am going to explain myself better.

    At this moment, I am using endpoint 8, ZCL_DEVICEID_ON_OFF_LIGHT_SWITCH with the clusters listed and the attributes required to switch the light from the coordinator. Now I want to add a occupancy sensor, should I change from Device ID On/Off light switch to Device ID On/Off in order to integrate Ocuppancy sensing  attribute 0x406 and being able to control the bulb from the output of the ocupancy sensor? Or should I not do this?

  • Hello Dani,

    The ZigBee Lighting & Occupancy Device Specification you are referring to is based off of the deprecated ZLL profile which was replaced by Zigbee 3.0 (PRO 2017/R23), nevertheless it is still a beneficial guide to follow for setting up your device.  You can also have multiple Zigbee endpoints existing on one device.  Thus the ZC can have both on/off light switch AND occupancy sensor device IDs existing on separate registered endpoints.  It would not use the on/off light device ID if it does not have such capabilities or usage.  You could also just add occupancy sensing as an additional cluster to the on/off light switch endpoint.  However, if you are simply measuring the occupancy sensor locally (I2C connection) and never need to report or transmit this information to other devices on the Zigbee network then there is no need to incorporate the occupancy sensing cluster into your project.  Since you've expressed the ability to read from the sensor and turn on/off the light, I share YK's opinion that you already have everything you need to control the light based on the incoming sensor data from your application.

    Regards,
    Ryan

  • Thank you.

    For example, I have 3 bulbs that I commit into the network with the coordinator connected with the occupancy sensor. Could I switch on all three bulbs based on occupancy sensor output? I would not need add occupacy sensor ID neither, right? And how could I choose the bulb which I want to switch on? It is possible?

  • You can send On/Off commands one-by-one to all lights or you can group them first and send group cast command to turn on/off lights in the same group.

  • Thank you.

    In my application bulbs and zed or zr can join the network. Can I separate those into 2 groups? A group of bulbs and a group of zed. If it is possible, how? I was thinking of looking for matching clusters but I do not know.

  • Yes, you can have different groups. You can assign different group ID when you use ZCL add group command.

  • There is a SimpleLink Academy Lab which covers the Zigbee group cluster.

    Regards,
    Ryan

  • Thank you, I will try this.

    The problem that I found now is that I tested the d6t-8l sensor based on a similar project on the resources files. Nevertheless, now I am trying to use it with the zc project and I can not configure SysCfg the same way. I think I need to configure I2C the same way but I can not add Bas Sensors Mark II I2C.

  • You should not need the exact BAS Sensors Mark II (Use Hardware) option which is not available for the Zigbee examples, it should be enough to use the same configuration and PinMux as the previous sensor-based project.

    Regards,
    Ryan

  • Thank you. It was enough, it worked.

    I am trying to separate into 2 groups, launchpads and bulbs, following your suggestions and the Simple academy lab that covers it. And I have some doubts. This code was used in "zclSampleSw_processZStackMsgs" of zcl_samplesw.c and I do not understand very well. I understand that it looks for the cluster ID_GENERAL_ON_OFF from the client of the zr_switch. And if it is found, there is a bind or whatever. Is it right?

     

    case zstackmsg_CmdIDs_ZDO_SIMPLE_DESC_RSP:
              {
                    zstackmsg_zdoSimpleDescRspInd_t *pInd;
                    pInd = (zstackmsg_zdoSimpleDescRspInd_t*)pMsg;
        
                    if((pInd->rsp.status == zstack_ZdpStatus_SUCCESS) && (pInd->rsp.simpleDesc.n_outputClusters))
                    {
                        while((*(pInd->rsp.simpleDesc.pOutputClusters) != ZCL_CLUSTER_ID_GENERAL_ON_OFF) && (pInd->rsp.simpleDesc.pOutputClusters != NULL))
                        {
                            pInd->rsp.simpleDesc.pOutputClusters++;
                        }
        
                        if(pInd->rsp.simpleDesc.pOutputClusters != NULL)
                        {
                            ...

    At this moment, zr_switch has defined basic, identify as input (client?) and identify, on off  and groups as a output (server?). But this clusters are in the bulb and in the other launchpads, right? So should I introduce a different cluster in the launchpads inr order to be able to differentiate?

    The other option was use another endpoint. With this option I would have to add the new endpoint in all launchpads, right? And in the simple descriptor only 1 endpoint can be defined.  I don't know how to register more endpoints.

    Thank you.

  • The SLA code you are referring to is designed specifically to manually find clusters which can be locally bound.  I do not recommend using this to identify node categories.  The server is input clusters, the client is output clusters.

    Endpoints are registered with zclport_registerEndpoint, typically during device initialization.  However, this is not recommended for differentiating devices, nor is using different clusters.  Instead, you could choose to read attributes with zcl_ReadAttrData to gather the ZCL_CLUSTER_ID_GENERAL_BASIC cluster's ATTRID_BASIC_MANUFACTURER_NAME or ATTRID_BASIC_MODEL_IDENTIFIER attributes (must be enabled in the node).  Another option, since TI and OSRAM have different OUIs, is to filter by IEEE address during the zstackmsg_CmdIDs_ZDO_DEVICE_ANNOUNCE.

    Regards,
    Ryan

  • Thank you. Now everything is more clear.

    I am trying first to read attributes with zcl_ReadAttrData. This command is used once in the project, in the addGroup function so I am trying to imitate this example. So I made this function in zcl_sampleapps_ui.c in order to show in the CUI the value. I called the zcl_ReadAttrData in order to read the attribute with the endpoint, id of basic cluster, manufacturer name's attribute, some parameter to save the attribute and its length. However, I am trying just to print the status returned and I am unable to show anything. Like it does not gets to return anything, stops before.

    It does not work because first I have to create a bind and just after a bind is created call it? I would say it has to be called after every commission, after a bind was created. But I am not sure. Thank you.

    static void uiActionSetIFTT(const char _input, char* _pLines[3], CUI_cursorInfo_t* _pCurInfo)
    {
        if (CUI_ITEM_INTERCEPT_START == _input) {
            ZStatus_t status = 0;
    
            uint8_t *atrLeido = FALSE;
            uint16_t *atrLen;
            status = zcl_ReadAttrData(SAMPLESW_ENDPOINT, ZCL_CLUSTER_ID_GENERAL_BASIC, ATTRID_BASIC_MANUFACTURER_NAME, atrLeido, NULL);
    
            char temp[16];
            uiUintToString(status, temp, 10, 2, TRUE, FALSE);
            strncpy(_pLines[0], temp, MAX_MENU_LINE_LEN);
            strncpy(_pLines[1], "*** EN DESARROLLO ***", MAX_MENU_LINE_LEN);
    
        }
    
    }

  • Sorry I forgot to ask the other question, is it possible bulbs like OSRAM's does not have manufacturer name?

  • You will need to implement the CUI_statusLinePrintf API to actually see a change in the CUI output.  I recommend you implement an additional CUI_statusLineResourceRequest during UI_Init to add your own information line to generate data as necessary.  Manufacturer name is an optional attribute of the Basic cluster, and thus you would receive ZCL_STATUS_UNSUPPORTED_ATTRIBUTE in those instances.

    Regards,
    Ryan

  • Hello,

    I tried having two endpoints in one device but I have some doubts. I created a new file similar to zcl_samplesw_data.c in order to save the new endpoint configuration. Then in zcl_samplesw.c I register the endpoint like the on/off light switch already registered. I do not know if this is the proper way to do it. I upload those files too. 

    6574.zcl_samplesw.zip

    Another question, having just "On/off ligth switch" device, can I just add the occupancy sensor cluster? Or it has to be just "On/off light" cluster? Thank you.

  • It is possible to register two endpoints in one application like with what you have provided.  You should have a separate list of ZCL General Cluster Library callback functions to register with SAMPLESW_ENDPOINT_OCCUPANCY, zclGeneral_RegisterCmdCallbacks.  You also re-use zclSampleSw_ResetAttributesToDefaultValues instead of having a standalone for the occupancy sensor attributes.  I doubt occupancy_data.c will build properly as the zclSampleSwOccupancy_Attrs appears to be missing curly brackets, furthermore there are duplicate constants defined.  I recommend that zclSampleSwOccupancy_SimpleDesc use ZCL_DEVICEID_OCCUPANCY_SENSOR for the AppDeviceId.  You should further build, run, and debug your project to observe its behavior.

    It is also possible to add occupancy sensor cluster to the existing on/off light switch endpoint.

    Regards,
    Ryan

  • Yes, it has some errors, I wrote it quickly because first I needed to know if that was a good option. I number the question so it is more easy to answer.

    1. Is there an endpoint reserved for that type of sensors? I.e. endpoint 9. Or you can choose whatever you want?

    2. When you say: "You should have a separate list of ZCL General Cluster Library callback functions to register with SAMPLESW_ENDPOINT_OCCUPANCY, zclGeneral_RegisterCmdCallbacks". This type of callback will be used for example when some value is reached and can be used to switch the light?

    3. But I shouldn't create a new file like zcl_samplesw.c in order to manage the new endpoint, right?

    Thank you.

  • 1. You can choose whatever you want.

    2. Couldn’t understand your question well. What do you mean “when some value is reached and can be used to switch the light?”
    3. It doesn’t matter. 

  • 1. Avoid endpoint 0 (Zigbee Device Object) and 0xF2 (Green Power), any others are available to choose.

    2. This may hardly matter for on/off switch and occupancy sensor device types, however you may for example wish for each endpoint's reset callback to differ.  Occupancy sensing also uses ZCL_MS and thus could have zclMS_AppCallbacks_t callbacks registered separately through zclMS_RegisterCmdCallbacks (although currently just a placeholder in the Z-Stack ZCL MS implementation).

    3. You can use a single c file to manage multiple endpoints, it's your choice whether a separate application file is necessary.

    Regards,
    Ryan