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.

understanding input/output clusters in EZ mode and end-device binding

Other Parts Discussed in Thread: Z-STACK

I am new to z-stack and digging through the sample application, and try to understand how things work. right now, I am reading the temperature sensor, thermostat, and heating/cooling unit sample application in the z-stack Home 1.2. I am a little confused about how the input/out clusters are defined in the binding process using EZ mode and end-devince binding request. 

In the sample temp sensor app, the code for end device binding is as follows:

// NOT ZCL_EZMODE, Use EndDeviceBind
static cId_t bindingOutClusters[] =
{
  ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT
};
#define ZCLSAMPLETEMPERATURESENSOR_BINDINGLIST        1

// Initiate an End Device Bind Request, this bind request will only use a cluster list that is important to binding.
ZDP_EndDeviceBindReq( &dstAddr, NLME_GetShortAddr(), SAMPLETEMPERATURESENSOR_ENDPOINT,
ZCL_HA_PROFILE_ID, 0, NULL, ZCLSAMPLETEMPERATURESENSOR_BINDINGLIST, bindingOutClusters,FALSE );

And for EZ mode binding, the following is used:

      static uint16 clusterIDs[] = { ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT };   // only bind on the Temperature Measurement cluster

      // Invoke EZ-Mode
      ezModeData.endpoint = SAMPLETEMPERATURESENSOR_ENDPOINT; // endpoint on which to invoke EZ-Mode
      if ( ( zclSampleTemperatureSensor_NwkState == DEV_ZB_COORD ) ||
           ( zclSampleTemperatureSensor_NwkState == DEV_ROUTER )   ||
           ( zclSampleTemperatureSensor_NwkState == DEV_END_DEVICE ) )
      {
        ezModeData.onNetwork = TRUE;      // node is already on the network
      }
      else
      {
        ezModeData.onNetwork = FALSE;     // node is not yet on the network
      }
      ezModeData.initiator = TRUE;        // Temperature Sensor is an initiator
      ezModeData.numActiveInClusters = 1;
      ezModeData.pActiveInClusterIDs = clusterIDs;
      ezModeData.numActiveOutClusters = 0;   // active output cluster
      ezModeData.pActiveOutClusterIDs = NULL;
      zcl_InvokeEZMode( &ezModeData );

In the simpledescriptor, the following is defined:

#define ZCLSAMPLETEMPERATURESENSOR_MAX_INCLUSTERS       3
const cId_t zclSampleTemperatureSensor_InClusterList[ZCLSAMPLETEMPERATURESENSOR_MAX_INCLUSTERS] =
{
  ZCL_CLUSTER_ID_GEN_BASIC,
  ZCL_CLUSTER_ID_GEN_IDENTIFY,
  ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT
};

#define ZCLSAMPLETEMPERATURESENSOR_MAX_OUTCLUSTERS       1
const cId_t zclSampleTemperatureSensor_OutClusterList[ZCLSAMPLETEMPERATURESENSOR_MAX_OUTCLUSTERS] =
{
  ZCL_CLUSTER_ID_GEN_IDENTIFY
};

For the thermostat, the following is defined:

#define ZCLSAMPLETHERMOSTAT_MAX_INCLUSTERS       3
const cId_t zclSampleThermostat_InClusterList[ZCLSAMPLETHERMOSTAT_MAX_INCLUSTERS] =
{
  ZCL_CLUSTER_ID_GEN_BASIC,
  ZCL_CLUSTER_ID_GEN_IDENTIFY,
  ZCL_CLUSTER_ID_HVAC_THERMOSTAT
};

#define ZCLSAMPLETHERMOSTAT_MAX_OUTCLUSTERS       1
const cId_t zclSampleThermostat_OutClusterList[ZCLSAMPLETHERMOSTAT_MAX_OUTCLUSTERS] =
{
  ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT
};

// NOT ZCL_EZMODE, Use EndDeviceBind
static cId_t bindingOutClusters[] =
{
  ZCL_CLUSTER_ID_HVAC_THERMOSTAT
};
#define ZCLSAMPLETHERMOSTAT_BINDINGLIST_OUT     1

static cId_t bindingInClusters[] =
{
  ZCL_CLUSTER_ID_HVAC_THERMOSTAT,
  ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT
};
#define ZCLSAMPLETHERMOSTAT_BINDINGLIST_IN      2

ZDP_EndDeviceBindReq( &dstAddr, NLME_GetShortAddr(),
                            SAMPLETHERMOSTAT_ENDPOINT,
                            ZCL_HA_PROFILE_ID,
                            ZCLSAMPLETHERMOSTAT_BINDINGLIST_IN, bindingInClusters,
                            ZCLSAMPLETHERMOSTAT_BINDINGLIST_OUT, bindingOutClusters,
                            TRUE );

//invoke EZ mode
      zclEZMode_InvokeData_t ezModeData;
      static uint16 clusterIDs[] = { ZCL_CLUSTER_ID_HVAC_THERMOSTAT };   // only bind on the Thermostat cluster

      // Invoke EZ-Mode
      ezModeData.endpoint = SAMPLETHERMOSTAT_ENDPOINT; // endpoint on which to invoke EZ-Mode
      if ( ( zclSampleThermostat_NwkState == DEV_ZB_COORD ) ||
           ( zclSampleThermostat_NwkState == DEV_ROUTER )   ||
           ( zclSampleThermostat_NwkState == DEV_END_DEVICE ) )
      {
        ezModeData.onNetwork = TRUE;      // node is already on the network
      }
      else
      {
        ezModeData.onNetwork = FALSE;     // node is not yet on the network
      }
      ezModeData.initiator = TRUE;        // Thermostat is an initiator
      ezModeData.numActiveInClusters = 0;
      ezModeData.pActiveInClusterIDs = NULL;
      ezModeData.numActiveOutClusters = 1;   // active output cluster
      ezModeData.pActiveOutClusterIDs = clusterIDs;
      zcl_InvokeEZMode( &ezModeData );

Here are my questions:

  1. doc says to use EZ mode bind thermostat and temp sensor, but they are both initiators, shouldn't we bind a initiator and a target?
  2. in the sample temp sensor app, the ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT is in the output clusters for end-device binding, and in the input clusters list for EZ mode binding. Why is this? 
  3. say we are binding thermostat and temp sensor, and they indeed can be paired. I suppose this works by matching ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT, in the input of temp sensor, and output in the thermostat. I can sort of understand how the ED binding works, but cannot seem to have a clue how it works in the EZ mode. 

Thanks a lot for your help on my lengthy question. 

  • I put together all the input/output clusters in different places into the following table. How EZ mode works is a mystery to me. (TM = ZCL_CLUSTER_ID_HVAC_THERMOSTAT, MS = ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT)

    Temperature Sensor Thermostat HVAC
    simpledesc - In MS TM TM
    simpledesc - Out MS
    EDB - In TM TM
    EDB - Out MS TM, MS
    EZ - initiator TRUE TRUE FALSE (target)
    EZ - In MS
    EZ - out TM
  • There are some documents that you can refer to as in the followings:

    1)C:\Texas Instruments\Z-Stack Home 1.2.0\Documents\Z-Stack Home Developer's Guide.pdf

    2)C:\Texas Instruments\Z-Stack Home 1.2.0\Documents\Z-Stack Home Sample Application User's Guide.pdf

    3)ZigBee Home Automation Profile Specification from http://www.zigbee.org/zigbee/en/spec_download/spec_download.asp?accesscode=1711389313

  • 1. doc says to use EZ mode bind thermostat and temp sensor, but they are both initiators, shouldn't we bind a initiator and a target?

    [] The initiator would be the device that wants to find a device to talk to and then create a binding table for it. If both the devices want to be able to send messages and require to find the targets then both can be initiator. They will find the right devices to talk to each other which will become the target for them. 

    2. In the sample temp sensor app, the ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT is in the output clusters for end-device binding, and in the input clusters list for EZ mode binding. Why is this? 

    [] In the HA-1.2 temperature sensor application the temperature measurement cluster is defined as an input cluster

    const cId_t zclSampleTemperatureSensor_InClusterList[ZCLSAMPLETEMPERATURESENSOR_MAX_INCLUSTERS] =
    {
    ZCL_CLUSTER_ID_GEN_BASIC,
    ZCL_CLUSTER_ID_GEN_IDENTIFY,
    ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT
    };

     

    3. say we are binding thermostat and temp sensor, and they indeed can be paired. I suppose this works by matching ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT, in the input of temp sensor, and output in the thermostat. I can sort of understand how the ED binding works, but cannot seem to have a clue how it works in the EZ mode

    In the EZ Mode the device sends out a ZDP match descriptor request to check if the other device supports a particular cluster in a required configuration (as a server or client) if it does the match descriptor response comes back with success and the endpoint number on the remote device. (I would recommend using Ubiqua packet sniffer and looking at over the air capture). when the match descriptor response is successful the device creates a binding table entry .

    Also, refer to the function zcl_EZModeAction() which implements the state machine for the EZ-Mode as it goes from one state to the next.

    Hope this helps. 

  • Hi Suyash,

    Thanks a lot for your detailed explanation. I think I understand better how EZ mode works now... Indeed as you described, it invokes ZDP_MatchDescReq after identifying. So, in this example of sample temperature, the IN cluster list contains MS_TEMP, so zclEZModeInvokeData.Inclusters contains MS_TEMP so that it can find a matching node with MS_TEMP defined in the OUT CLUSTER, which is the thermostat node. In this case, the temp sensor is the data server, and the thermostat is the client on this cluster. And the same for the matching between thermostat and heating cooling unit. Is my understanding correct?

    Next, then, what does it mean to invoke an EZ mode on the heating/cooling unit with both in/out cluster list defined as NULL? Such parameters go into ZDP_MatchDescReq will receive response from no one?

    Thanks again.

  • 1. Your understanding is correct.

    2. Yes. With both in/out cluster list defined as NULL, ZDP_MatchDescReq will receive response from no one.

  • Hi Suyash


    I am so glad I found this post. I've been trying to figure out how EZ mode works for some time now. This post cleared some of the doubts I had, but I'm still unable to understand how it works clearly. I am using Sample Temperature Sensor and Sample Thermostat sample applications and these are what I don't understand

    1. If two devices are to bind with each other, isn't it necessary for one of them to have a cluster ID defined as an output cluster and for the other to have the same cluster ID defined as an input cluster? If this is correct, where should these cluster IDs be defined?


    2. What is the basic criteria for one device to be able to send data to another device? It is really confusing to me that in the Sample Temperature Sensor application, ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT is defined as an input cluster when it is actually sending data (an output function).

    3. In the EZ mode invoke function when SW2 is pressed, only the inClusterID is defined ( as ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT) for the Sample Temperature Sensor application and only the outCluster is defined (as ZCL_CLUSTER_ID_HVAC_THERMOSTAT) for the Sample Thermostat appliation. Still the devices are able to pair with each other without matching cluster IDs. How is this possible

    Any help on this would be appretiated

    Thanks,

    Varun Warrier

  • 1. In/Out cluster are defined in zcl_sampletemperaturesensor_data.c and zcl_samplethermostat_data.c

    2. You only have to know destination short address and end point. These are enough to send data from a device to another.

    3. In EZ mode,  the devices are able to pair with each other only with matching cluster IDs

  • Thank you. This discussion has helped me greatly in understanding ZCL and EZ mode pairing. I have a question though. I am trying the home automation demos. As far as I understand, in the Temperature sensor-Thermostat-heating/cooling unit demo, the thermostat receives temperature reading from sensor and sends on/off commands to the heating/cooling unit, but there is no status reporting from the heating/cooling unit to the thermostat.

    Is there any way to establish a bi-directional communication between two nodes using the ZCL Home Automation profile? For example, from a controller node I want to get(receive) the current status of the controlled device and send commands  to the controlled device as well.


    Thanks in advance.

  • Awal,

    To control on/off, you can refer to SampleSwitch and SampleLight example.