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.

Modifying Home Automation Public Profile

While using Home Automation Public Profile, e.g. SampleLight/Switch demo, if I wish to transmit not just ON/OFF or LEVEL_CONTROL commands but also data strings from both (Switch to Light) and (Light to Switch), what is the best way? In HA profile, I can not access the AF_Incoming message directly with customized Clusters(like the SerialApp demo) , since ZCLProcessMessageMSG() will block them. I guess I can add a customized Attribute to the General ON/OFF cluster and use 'Report Attribute' command to send data from the server to client and use 'Write Attribute No Response Command' to send data from client to server. Am I getting it right?

In zcl_general.h, adding a new attribute-

#define ATTRID_ON_OFF_STR_DATA        0x4004

Is there any restriction on the value to be used, e.g. 0x4004?


In zcl_samplesw_data.c,

zclSampleSw_Attrs[SAMPLESW_MAX_ATTRIBUTES]=

{          ZCL_CLUSTER_ID_GEN_ON_OFF,

           { ATTR_ON_OFF,

              ZCLDATATYPE_CHAR_STR,

              ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE,

              (void *) &zclSampleSW_OnOff_Str_Data

}

}

Where else do I need to use/add the red marked pointer? Will these modifications suffice to send a string?

  • I would recommend using a different ATTR ID (ATTR_ON_OFF), so not to clash with existing ID's.

    Regards, TC.

  • Thanks for the reply. I did use a different Attribute ID. Reporting from SampleLight to SampleSwitch works fine. But the problem is, when I use a 'Write Attribute No Response' command from the SampleSwitch, it is automatically handled by the ZCL layer in the SampleLight. I cannot directly use ZCL_CMD_WRITE_NO_RSP in zclSampleLight_ProcessIncomingMsg(). Is there any other command/anything using which I can send a string of data from SampleSwitch and get instant notification in SampleLight?

  • Finally I made my system work, but gave up Home Automation Public Profile. I don't need interoperability any way, so 'No Profile' works for me. Now that I don't have the ZCL layer filtering and restricting me, I can do almost anything I want with the AF layer.

  • Hello M A Awal,

    first of all congrats for your success :)

    Actually i am also facing same kind of problem...i also want to do similar things like you did so would you like to tell me how you solved your problem? becoz i am not able to solve my problem..

    so i am requesting you if you can just share how you solved this issue...

    Thanks & Regards,

    Maneesh 

  • Hello M A Awal,

    will plz share with me how you solved your issue...

    i am also facing same kind of problem so plz help me solve this issue....

    Regards,

    Maneesh

  • Can you be a bit more specific about your problem? Are you trying to send/receive string data between multiple node? Do you need any public application profile?

  • Hello M A Awal,

    Thanks for replying...

    1) Actually as u were trying to send data string to a sample light from switch i also want to do the same thing...

    i want to send on/off cmd and string from switch to light and light will reply back about status by some data string...

    so it will be very helpful for me if u can share ur source code with me if u dont mind..... 

    2) yes i want send /receive string between multiple node...

    3) actually right now i am testing it on HA profile only and if it doesnt work then only i will think to use any private profile..but right now i am not sure...if u can guide me or help me in this then it will be very helpful for me..

    4) and i hav a doubt is this possible to hav a sample light, and sample temp sensor on a single endpoint ?or i need two different endpoint for this ? 

  • 1. You can do it in two ways- Firstly, you may use attribute reporting from 'SampleLight' to 'SampleSw'. Refer to 'SampleTemperatureSensor' for the details on how to send an attribute report and adopt for your code in SampleLight. You may write a local function which sends the On/Off attribute report and call that function each time the SampleLight receives a On/Off or Toggle command. In this case the reporting is triggered from the SampleLight.

    Secondly, if you want to know the On/Off status from the SampleSwitch anytime(reporting not controlled by SampleLight), you may use SendRead() command in the SampleSwitch.Use something like this to request an attribute read-

    zclReadCmd_t *pReadCmd;

      pReadCmd = osal_mem_alloc( sizeof(zclReadCmd_t) + sizeof(uint16) ); // size of zclReadCmd_t depends on the number of attributes.
                                                                        //Therefore num of attrib*size(AttrID), AttrID=uint16
      if ( pReadCmd != NULL )
      {
        pReadCmd->numAttr = 1;
        pReadCmd->attrID[0]= ATTRID_ON_OFF;
        

        zcl_SendRead( SAMPLESW_ENDPOINT, &zclSampleSw_DstAddr,
                           ZCL_CLUSTER_ID_GEN_ON_OFF,
                           pReadCmd, ZCL_FRAME_CLIENT_SERVER_DIR, TRUE, zclSampleSwSeqNum++ );
        
        
      }

      osal_mem_free( pReadCmd );

    And you will get the attribute report in zclSampleSw_ProcessInReadRspCmd() function. Modify the function according to your need to read the attribute value.


    2 & 3. If you don't want interoperability, then you're better off using GenericApp or SerialApp. Then you can directly send/receive long string messages to/from any node.

    4. If you don't use HA profile, then you won't be restrained by the predefined cluster specification or device types.