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.

Feedback in Samplelight when turning ON/OFF

Other Parts Discussed in Thread: Z-STACK, CC2530

Hello Everyone,

I am using CC2530 on SmartRF05 Board and also using Home Automation Z-Stack Profile, here when I send ON/OFF command from Coordinator through RF I get a feedback of whether the device is turned ON/OFF, But when I do the same thing using joystick on the End Device this feedback is not sent to the coordinator, How can I implement this feedback system?

  • You have to use zcl_SendReportCmd() to send ON/OFF status by yourself when you toggle LED using joystick on end device.
  • Sir can I have example for this?
    I am unable to resolve some parameters of zcl_SendReportCmd() .
  • You can refer to the following codes in red.

    static void zclSampleLight_OnOffCB( uint8 cmd )

    {

    zclReportCmd_t rptcmd;

    // Turn on the light

    if ( cmd == COMMAND_ON )

    zclSampleLight_OnOff = LIGHT_ON;

    // Turn off the light

    else if ( cmd == COMMAND_OFF )

    zclSampleLight_OnOff = LIGHT_OFF;

    // Toggle the light

    else

    {

    if ( zclSampleLight_OnOff == LIGHT_OFF )

    zclSampleLight_OnOff = LIGHT_ON;

    else

    zclSampleLight_OnOff = LIGHT_OFF;

    }

    // In this sample app, we use LED4 to simulate the Light

    if ( zclSampleLight_OnOff == LIGHT_ON )

    HalLedSet( HAL_LED_4, HAL_LED_MODE_ON );

    else

    HalLedSet( HAL_LED_4, HAL_LED_MODE_OFF );

    rptcmd.numAttr = 1;

    rptcmd.attrList[0].attrID = ATTRID_ON_OFF;

    rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;

    rptcmd.attrList[0].attrData = (uint8*)&zclSampleLight_OnOff;

    zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT, 0,

    ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd,

    ZCL_FRAME_CLIENT_SERVER_DIR, false, 0 );

    }

  • Sir at coordinator side I am using Linux Gateway using ZNP.

    So for this will I have to process this report cmd ? What API would be needed for the same?
  • I have not trace the code on Linux Gateway for this part. It should be very easy so you can test it and see how it works.
  • Sit I am unable to update values in rptcmd, I have tried debugging it and even after the zclSampleLight_OnOff is update it is unable to update its corresponding attribute list I have attached screen shots of debug mode.

  • I suggest you using Ubiqua Packet Analyzer to check if SampleLight sends ON/OFF report.
  • Sir but attribute list is not been updated. Due to which it is unable to send data.
    Do this command need to be registered in cluster?
  • When there is on/off event trigger, you should update zclSampleLight_OnOff and use zcl_SendReportCmd to send zclSampleLight_OnOff in your application.
  • Sir we have tried using Ubiqua, here we have hard coded the Destination Address for zcl_SendReportCmd, where can I get destination address in Z-Stack HA?
  • Yes. When device joins Zigbee network, it should broadcast end node announcement and you should keep it in your application at that time.
  • Hi Mr Yikai, how are you?

    I trying to send from my device the ZCL Default Response to GTW, i wrote the code that you adivise on zcl_samplelight.c,  but my device continue don't send it.

    I also set up the ZCL REPORT (on f8wZCL.cfg).  I have another commercial device to compare, to exclude the gtw, and it work very well. Could you help me to fix it?

    The Commercial device ZCL Default Response:

  • Do you check the return status of zcl_SendReportCmd?
  • Hi Mr Yakai, thanks a lot for your quickly replay!

    Would you can advise me,  haw can I do check the status of zcl_SendRsportCmd?

  • Dear Alexander,

    You can check status by checking response of zcl_SendRsportCmd().
    When you call this command there is a status response as ZSuccess or Failure.
  • You can use a variable ret to catch the return value of zcl_SendReportCmd and check it.

    rest=zcl_SendReportCmd(...

  • Mr Yikai, sorry for my ingnorance. But you can adivise me how to building the structure to check the Zcl_SendReportCmd status?

    for example:

    int rest();

    rest=zcl_SendReportCmd (SAMPLELIGHT_ENDPOINT, 0,ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd,ZCL_FRAME_CLIENT_SERVER_DIR, false, 0 );

    BR

    Alex

  • You can use the following code example and check ret value after run zcl_SendReportCmd.

    ZStatus_t ret;
    ret=zcl_SendReportCmd (SAMPLELIGHT_ENDPOINT, 0,ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd,ZCL_FRAME_CLIENT_SERVER_DIR, false, 0 );
  • Hi Mr Yakai!

    I have a suspect that my device, after join in a zigbee network, left from this network, maybe the device was reset alone. Did you help me to find a specific variable or register that i can find if my device still conecting on the gateway?

    If you have an old post that i can study better the CC2530 debuging,please do you can share with me?

    Thanks a lot for your assistance.

    BR

    Alex

  • If an end device disconect scrim its parent, it would trigger ZDO_SyncIndicationCB. You can set a breakpoint in ZDO_SyncIndicationCB to check if end device left network.
  • Dear Yakai, i was see that the breakpoint was reachable on ZDO_SincIndcationCB! I think that it indicate that my device was disconnected after joined in my network, as we suspected.  As you can see below:

    I was triger the messages in the protocol analyzer (wireshark), and i can see that after the DeviceAnnounced my device sent sucesibles DataRequest. I think that it is not normal. Would you can help to interpret it? Please!

    My device has a follow address: 00:12:4b:00:xx:xx:26:ca

    My Commercial GT has a follow address: 00:02:00:04:xx:xx:00:04

  • So, the problem should be why your device would leave network? What HW do you test this and can you attach your sniffer log?
  • Thanks a lot for your quickly response!!!

    Yes, i think it happens after my device leave from my network. I use one that i made myself. I using an generic chinese main module. I including the sniffer log as you request me! 

    As you know i using a default files (samplesw) designed to use in SmartRF05EB (HAL_BOARD_CFG)!

    4276.CC2530 Module V1.50 Datasheet.pdf

    MyDeviceJoinedFromMyNet_a.rar

  • This sniffer log starts with device doing beacon request. I need you to redo the test which shows device is connected to network and then turn orphan to send beacon request to rejoin.
  • Dear Yakai, apologize my mistake!

    The file that i sent is correct, but i have a Zigbee polution in my house, i have another devices in another network, formed by another ZB gateway, but booth networks is working under the same ZB CH (11). 

    I forgot to explain better for you the mesage sequence. I include an attached PIC in the exact moment when my device was join in my network, in the same moment that i was see the debug trigger. Do you can see it after the message 33 (included).  I really have a doubts, after the Dev Announcement we can see sucesives MAC Data Requests,after mesage 43. It is a normal behavior?

    My Network has:

    PAN ID 0x113d

    ZB Short Add: 0x7970 (My Device)

    ZB Short Add: 0x0000 (Commercial GTW).

  • It's normal to see data requests.

  • Me Yikai, would you help me to find a variable that i can change to turn Off THE Data req?

    Ill try to design a ligth switch, i think that DataReq generally We using to a sensors reporting method!

  • You can change "-DPOLL_RATE=1000" to "-DPOLL_RATE=0" in f8wconfig.cfg. However, this would make end device cannot receive any message.
  • Dear Yikai, thanks a lot for your assistance.

    I can check, after your advise, that my Device stays connected. I can right now starting to find the main problem, that i talked with you, as about the ZCL Default Response Command.

    I was write the code that you sent me, but i got a few problems during the IAR compile procedure, as you can see below:

    Please, would you can help, me? I include my ZCL.C in this post.

    IAR Error

      

    Part of the ZCL Code, that include the ret code.

    zcl.c

  • I think you don't define SAMPLELIGHT_ENDPOINT and rptcmd in your revised ZCL.c. You have to define them to remove compile errors.
  • By the way, your questions now are not related to the topic of this discussion thread so please kick off a new one if you still have problems.
  • Hi,

    I have a similar requirement. I am integrating a zigbee based light from vendors such as Climax. It supports ZB HA profile.

    In my coordinator, I want to receive a notification when I manually switch OFF/ON the light using button on device.  How can I enable receiving notifications on coordinator side. I don't think I can change anything on the device side and I am assuming it is enabled with reporting mechanisms as part of the HA profile.

    I can turn ON/OFF light when I send command through coordinator using sample application, but I also want to receive the updates when the light  is manually turned ON/OFF.

    Thanks,

    Sonal

  • You have to binding ON/OFF cluster to the device so the device can report status back.
  • Thanks, could you please let me know how to do that? I cannot change anything on the device side. Is there a way to know if device has enabled reporting?
    I just want to verify I have enabled all the required input clusters on coordinator side in order to receive reports.
  • What is your coordinator? Do you run Ztool and connect ZNP to act as coordinator?
  • I am using the sample application provided by TI, "HAGATEWAY" which acts as a coordinator.
  • Do you mean you use Z-Stack Linux Home GW reference design?
  • Yes, Could you please give reference of some basic zigbee call flow? I am getting AF_INCOMING_MSG when I send out some command from co-ordinator to zigbee switch. I was expecting to get this indication when I turn switch ON/OFF.
  • You have to send ZDP binding to ON/OFF cluster to the device to make it report ON/OFF status.
  • Hi,

    While going through Zstack code, I came across this flag ZCL_REPORTING_OFF in Components/zcl.h file , doesnt seem to be used anywhere. Any idea?
  • I don't think it's related to your issue .
  • Hi,

    I am trying to enable reporting for Byun ON/OFF switch with the demo app. I have added following changes in user_interface.c file for switch case 'y':

    attr_configure_reporting(destination_addr, gateway_self_addr, 0, CLUSTER_ID_ONOFF, ATTRID_ON_OFF, GW_ZCL_ATTRIBUTE_DATA_TYPES_T__ZCL_DATATYPE_BOOLEAN);

    I commented the attribute reporting for Temperature measurement and Humdiity which is the sample code in user_interface.c

    Steps to run:

    1. Run HA gateway with command: "hagateway x86"

    2. Run sample application with command: "./start_application

    3. Press "P" to permit join requests.

    4. My Zigbee switch then connects to gateway and joins the network. It has 3 ON/OFF buttons shown as 3 endpoints on the console:

    IEEE_ADDR ADDR EP DETAILS | EP DETAILS | ...
    00:12:4B:00:08:B8:3F:1E 0000 02 0007(HA) | 03 0100(HA) | 04 0101(HA) | 05 0102(HA) | 06 0102(HA)
    >00:12:4B:00:08:93:F7:F4 6DBE 03 ON/OFF SWITCH | 02 ON/OFF SWITCH | 01 ON/OFF SWITCH

    5. Now I select the endpoint on switch and press "y" to enable reporting.

    But I am getting following error:

    received from GATEWAY: len=6, cmd_id=0, subsystem=115
    Raw=06:00:73:00:08:00:10:00:18:00
    Calling confirmation callback
    attr_read_confirm_handler: Received ZIGBEE_GENERIC_CNF
    attr_read_confirm_handler: Status SUCCESS.
    Reporting Register state 4
    received from NWK_MGR: len=21, cmd_id=27, subsystem=82
    Raw=15:00:52:1B:08:1B:10:01:18:00:22:0D:08:00:11:F4:F7:93:08:00:4B:12:00:28:03
    comm_device_binding_entry_request_rsp_ind Received NWK_MGR_CMD_ID_T__NWK_SET_BINDING_ENTRY_RSP_IND
    Bind/Unbind successful
    sourceaddress 0x124b000893f7f4 endpoint 0x3
    Reporting Register state 5
    Unregistering state machine (00422e4a)
    received from GATEWAY: len=12, cmd_id=21, subsystem=83
    Raw=0C:00:53:15:08:15:10:00:18:04:22:02:08:00:28:00
    attr_process_set_attribute_reporting_rsp_ind: WARNING: Status FAILURE msg->status = 4

    I want the demo app to show the status of switch ON/OFF on the console, when I manually press the switch. The reverse is working fine, i.e. if I select the respective endpoint and press N/F then the switch is turned ON/OFF.

    Please guide me. What steps have I missed? Where can I get more information on the status and error codes?

    Thanks,

    Sonal