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.

CC2530: how to modify z-stack sample light code to work with multiple devices?

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK,

Hi guys,
I'm using cc2530 Zigbee module and z-stack home automation 1.2.2a sample light code.
This code have written for one gang switch I'm trying to modify that to work with two gang switch (or light) what should I do?
I mean just one device can be read in this code, and I'm trying to read two different devices and send data to my hub.

  • Hi armin,

    I suggest you read the Z-Stack Developer's Guides and API documents to get a better understanding of Zigbee groups, clusters, and endpoints.  The light can be bound or bind to multiple switches which send on/off commands or report attributes to the light's endpoint.  You can also create multiple light endpoints, all of which report attributes/data.  Please be more specific as to what exactly you are trying to accomplish.

    Regards,
    Ryan

  • Part Number: CC2530

    Hi guys,
    I'm using cc2530 Zigbee module and z-stack home automation 1.2.2a sample light code.
    I'm trying to send one of my attributes to the hub and I'm looking for a proper approach or a function that help me to do that.

  • If the light is bound to one of the hub's endpoints then you can accomplish this with automatic attribute reporting, otherwise you can use zcl_SendReportCmd.

    Regards,
    Ryan

  • Hi Ryan,

    thanks for your reply,

    1- actually I used zcl_SendReportCmd but it's not working is there any help or doc that tell me how to use that.

    2- and how can I automatically send that attribute

    this is my code:

    static void zclSampleTemperatureSensor_SendTemp( void )
    {
    #ifdef ZCL_REPORT
      zclReportCmd_t *pReportCmd;

      pReportCmd = osal_mem_alloc( sizeof(zclReportCmd_t) + sizeof(zclReport_t) );
      if ( pReportCmd != NULL )
      {
        pReportCmd->numAttr = 1;
        pReportCmd->attrList[0].attrID = ATTRID_MS_TEMPERATURE_MEASURED_VALUE;
        pReportCmd->attrList[0].dataType = ZCL_DATATYPE_INT16;
        pReportCmd->attrList[0].attrData = (void *)(&zclSampleTemperatureSensor_MeasuredValue);

        zcl_SendReportCmd( SAMPLETEMPERATURESENSOR_ENDPOINT, &zclSampleTemperatureSensor_DstAddr,
                           ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT,
                           pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, TRUE, zclSampleTemperatureSensorSeqNum++ );
      }

      osal_mem_free( pReportCmd );
    #endif  // ZCL_REPORT
    }

  • Hello armin,

    You will need to debug the return status of zcl_SendReportCmd and check the OTA communication with a sniffer.  You can also refer to the ZCL API for documentation and the TemperatureSensor & Thermostat samples for an example of attribute reporting.  All of the methods you are attempting to implement (assuming indirect address mode) depend on bound endpoints and it is unclear whether this has actually been done in your application.

    Regards,
    Ryan