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.

Z-stack Home 1.2.2 HA profile Light Toggling

Other Parts Discussed in Thread: Z-STACK

Which file i can get port & pin configuration of led connected in light project for toggling,on and off process under home automation in z-stack home 1.2.2?

  • You still can use AF_DataRequest to send non ZCL command but you have to done some modification in ZCL.c
  • By the way, you can refer to the following parameters to send ZCL toggle command with AF_DataRequest

    <TX>09:50:34.49 COM4 AF_DATA_REQUEST (0x2401)
    DstAddr: xxxx
    DestEndpoint: 0xxx
    SrcEndpoint: 0xxx
    ClusterID: 0x0006
    TransID: 0x00
    Options: 0x00
    Radius: 0x00
    Len: 0x03
    Data: ... (0x01, 0x01, 0x02)
  • Hi Yikai,
    1)What modification you are talking about that i need to make to send non-zcl command in zcl.c
    2)In your previous post you have specified "Len" field value as 0x03 which means length of data is 3bytes but Data field is ...(0x01, 0x01, 0x02) which is one byte only. Including this light control command what do i need to keep in data field or simply i can modify "Len" field to 1 byte and send either of (0x01-0x03).
  • Hi Yikai,
    I had tried to debug by setting breakpoint at switch ( MSGpkt->hdr.event ) of uint16 zclSampleLight_event_loop( uint8 task_id, uint16 events ). Each time i am sending command through hyper terminal then breakpoint hits but non of the case of switch case gets processed and next line processed is osal_msg_deallocate( (uint8 *)MSGpkt );. if i am right then if any command is sent then it should process case ZCL_INCOMING_MSG: but its getting processed in my case. what may cause for this? In sniffer also i can see that ZED sends back some data when it receives and command from ZC.
  • Sorry. case ZCL_INCOMING_MSG: is not processed when zed receives any command.
  • I should hit zclSampleLight_OnOffCB.
  • but breakpoint at zclSampleLight_OnOffCB is not hit. If breakpoint is hit at switch ( MSGpkt->hdr.event ) of zclSampleLight_event_loop() when command is sent from ZC to ZED and also in sniffer i can see that ZED is sending back some data when it receives any command. So there must be something wrong in processing the received data. What do i need to check next?
  • For debugging if i want to check what data is received from the ZC then in which function can i call HalUARTWrite() which will transmit received data through uart so that i can confirm whether correct toggle command is received at ZED. In this stack i can't find ZB_RECEIVE_DATA_INDICATION() which i was using in 2.5.0 to check the received data using HalUARTWrite().
  • After checking your sniffer log again, I see the endpoint of toggle command is set to 0 and this is the problem.
  • All received data would go through zcl_event_loop(). If you want to dump anything, you can do it in "if ( *msgPtr == AF_INCOMING_MSG_CMD )" statement in zcl_event_loop().
  • I had tried by placing breakpoint at various place in zcl_ProcessMessageMSG() and found that clusterid,end point,transid,data length are received correctly at ZED. Only thing which is not correctly received is data(pkt->cmd.Data) which shows 0xce0
  • In earlier post you had specified "Len" field value as 0x03 which means length of data is 3bytes but Data field is ...(0x01, 0x01, 0x02) which is one byte only. Including this light control command what do i need to keep in data field or simply i can modify "Len" field to 1 byte and send either of (0x01-0x03). Right now i am sending Len=0x01 and data=0x03. Am i doing wrong in setting Len and data field?
  • IT is 3 bytes data which are {0x01,0x01,0x02}. The first byte is frame control of ZCL payload, the seconds byte is sequence number, and the 3rd is command.
  • Hi Yikai,
    I am sending following sequence FE 0D 24 01 85 BE 08 08 06 00 00 00 00 03 01 01 02 14 (where 0xBE85 is short address,0x08 is EP of zc and zed,06 is clusterid)through hyper terminal and led is toggling fine but with switch press led is not toggling. I am using
    zclGeneral_SendOnOff_CmdToggle( SAMPLESW_ENDPOINT, &zclSampleSw_DstAddr, FALSE, 0 ); for led toggling using key press. why it happens?
  • sorry for typo. clusterid is 0x0006 in seq
  • I think the problem is on zclSampleSw_DstAddr.
  • Do you mean that toggle command is not getting sent to correct end device and zclSampleSw_DstAddr doesn't store correct address? If so then I don't think it may be like that because in sniffer i can see that toggle command is sent to the same short address of end device which is polling for data at ZC. Not only that through debugging also i could find that zed is receiving some data when i am sending unicast data from zc. if address will not be correct then how breakpoint will be hit?
  • Do you check endpoint in your zclSampleSw_DstAddr?

  • If you are looking at the sniffer log for getting the endpoint and all then i want to tell you that my sniffer is displaying wrong information like profileid,clusterid,source& destn end point. This thing i found when i was debugging. while debugging i found that these displayed parameter in sniffer log and actual data received while debugging were different. I have not made any changes to the default values of these parameter as specified by z-stack. So EP i was receiving correctly while debugging which is 8 by default.
  • Sorry i misunderstood your question. I had requested for active end point after device annce occured and i got active response as 0x08 from end device and same end point i am receiving when i am sending toggle command through debugging as i told before.
  • I suggest you set a breakpoint at ZCL toggle command and check zclSampleSw_DstAddr first.
  • Ya its correct. I had checked by debugging in zcl_SendCommand also which is getting called by zclGeneral_SendOnOff_CmdToggle( SAMPLESW_ENDPOINT, &zclSampleSw_DstAddr, FALSE, 0 ); In this function(zcl_SendCommand) also i am getting the exact address of zed. all parameters like short address,clusterid,endpoint,command etc are correct
  • If you find time then please have a look at it(this is 2nd priority). Here i have included sniffer log. Sorry for file size to be too large. I am not getting similar packets and that's why i have included such big file. I was testing toggling command through hyper terminal one ready made zigbee product which is power outlet and which acts as router. In sniffer log you can see the packet details after i had started. In log you can find another end device packets also with short address 0xbe85 which was already connected to the coordinator. please do not concentrate and ignore packets with short address (0xbe85).
    Packet No 9537 is the packet where i had powered on the router(readymade device) and during this time i had disabled SECURE=1 and TC_LINKKEY_JOIN. Till packet no 9791 you can see that router was not associating to the coordinator.
    Then i had enabled SECURE=1 & TC_LINKKEY_JOIN as you had told before that for these devices we need to enable these parameters. you can see in log that 0x7697 short address was assigned to the router and later it got disassociated and again short address was assigned(0x7364). After this you can see in log that router is not polling for data at zc and even if i restarted and factory reseted it, its not sending any beacon or device annce and thereafter i am getting only broadcast message from router which is some unknown command.
    Same thing was happening while testing phillips hue also after enabling those parameters and i was getting similar kinds of packets for hue also. Why using "SECURE=1 and TC_LINKKEY_JOIN" is making such change and there after device is not able to associate with the network? Rest i will be continuing tomorrow.ab.psd

  • 1. It is not possible that you use the sample address and endpoint in zclGeneral_SendOnOff_CmdToggl but cannot send command.
    2. Router in Zigbee network doesn't polling. Only end device does. By the way, I don't understand your question well. Can you explain what you want to do?
  • Hi Yikai,
    1)That's what i am also not able to understand why led is not toggling using switch press even though address,endpoint,command and other parameters are received correctly at zed. I will try to find the difference in between received data when command sent from hyperterminal and switch press and then i may be able to find the actual cause why its not toggling.
    2)I want to control phillips hue and ready made power outlet from my coordinator like on/off. For this i need to associate them with my coordinator but its not associating. I am thinking so because device annce doesn't occur when i power recycle both of my ready made devices. And unless it associates with my coordinator how can i control them? In sniffer log you can see that after short address has been assigned to the device there is no packet for device annce even though i had power recycled several times. Above all i am not able to judge whether device is associated with my ZC or not.
  • Id this ready made power outlet made by you? If so, do you enable SECURE=1 and TC_LINKKEY_JOIN on it? I have tested Philips Hue many times to join SampleSwitch (Act as ZC) in Z-Stack Home without problem. I suggest you can try it first.
  • No. Its ready made product from centralite. Ya i had enabled SECURE=1 and TC_LINKKEY_JOIN on my zc. Actually i am not able to judge whether this device is associated with my network or not. Is there any test by which i can confirm whether its joined to my zc. In sniffer i can see that zed(with some short address) is sending some unknown packets at regular interval but not sure its really associated or not.
  • Your previous sniffer log is too erratic. I suggest you do it one by one. Use sniffer to trace the process of centralite joining your ZC only. Don't mess up with Hue.
  • By the way, you should buy Ubiqua Packet Analyzer if you want to integrate all those 3rd devices.
  • In Previous sniffer log one of my zed(with short address 0xbe85) was in on condition. then i had switched on centralite. hue was not switched on at all. I had mentioned hue to just to tell the behaviour in packet reception was similar when i had factory reseted hue. In my previous log only i was getting device annce and APS frames after i had enabled SECURE=1 and TC_LINKKEY_JOIN. After that i am not getting these device annce and aps frame packets. I have included the new sniffer log when only zc and centralite is in on condition.

    I do know the importance of using Ubiqua Packet Analyzer which is very helpful in getting detailed process of packet transmission through air but its not possible for me to afford such huge amount(999$ which may be approx 60000-65000 in indian rupees). I am extremely sorry for that.

    b.psd

  • What is this new sniffer log? I don't see any association in it.
  • Previous log shows the packet transmission when my zc was in on condition and later i had switched on centralite. Similar kinds of packets are received when i power recycle centralite every time. I have included new low which shows packet received when i had factory resetted it. Is it getting associated with my zc?

    c.psd

  • I see a router with 0x86D6 as short address joins ZC.
  • Hi Yikai,

    Is it possible that sniffer will capture data transmission to an unassociated device in a network? I mean if i know the short address and if i want to send some data to that device even if the device is not in network then will there be any packet seen in the sniffer log? No matter packet is delivered to destination or not.

    Again centralite device is not associating with my zc as you can see in the log. Even after factory resetting its not associating. sniffer shows zc powered on first and centralite device swithced off and later centralite device factroy resettede.psd

  • Basically, sniffer will capture all data transmission no matter it is associated or not. But what is your point. By the way, I remember I had integrate centralite Zigbee smart plug to our HA GW without problem.
  • Hi Yikai,

    Here i have included sniffer log for data transmission when my zc and centralite is in on condition. Initially, only my zc is in ON condition and centralite is in off condition. Then i had powered on centralite. The APS packets are received as seen in the sniffer log.

    1)I want to know whether centralite is associated with my zc.

    2)from sniffer log i can see that centralite has short address as 0x86d6. So if i send active end point request from hyper terminal with 0x86d6 as nwkaddr then will sniffer capture this request.8081.router.psd

  • Hi Yikai,

    Sorry for not replying to your post. I was busy in some important work and couldn't find time to work on zigbee.

    1)Actually i wanted to send some MT command like active end point request to centralite through hyper terminal using the short address as seen in the sniffer log. I had sent this request but i am not finding any request packet transmitted over the air.

    2)Here i have included the data packets captured by ubiqua packet analyzer. I have downloaded trial version. In this log initially zc was powered and later i had powered on centralite. Can you please tell me whether centralite is asociated with my zc?  If its associated  then how can i test centralite? is it by plugging light to the terminal and sending light toggle command. I am trying to attach .cubx log but its not getting attached

  • I don't see any beacon request and association in your sniffer log so I believe the centralite device doesn't join ZC. Do you do factory reset on  centralite device and do permit join on your ZC to make it join?

  • I had enabled permit join NLME_PermitJoiningRequest(0xff); in void zclSampleSw_Init( byte task_id )
     of zcl_samplesw file. For resetting centralite i had continuously pressed the button provided in it and held for sometime until the green status button glows while powering it. I find these kind of packets in sniffer log. I had repeated the resetting process like this twice or thrice. I don't find any association packet. I had enabled security SECURE=1 & TC_LINKKEY_JOIN. If its my own designed device then i can doubt in fw and make some changes but what i can do in these readymade
    devices. Similar thing results for hue also(hue packets not available in this sniffer log.

  • From your sniffer log, I think you don't do factory reset correctly to either centralite device or Philips hue. Unless you do factory reset correctly, they won't send beacon request and start to join your ZC.
  • I am doing following process to factory  reset.Is it correct?

  • If I remember correct, this is right steps to do factory reset to Centralite device.
  • Most of the time i reset it, i get APS packets but no association packets. In rare case new short address is assigned. What else i should try?
  • I have no idea. It should send beacon request after factory reset. If not, you should contact vender.
  • will these devices be using default security key as defined by z-stack?
  • As I know, centralite has Zigbee HA certification and it supposes using default key. The problem is that I cannot see your centralite sending beacon request.
  • I will try to contact the vendor tomorrow and see if i can find solution. After power recycle/factory resetting, Hue sends a single packet and after that it doesn't send even a single packet
  • 1)Can a router act as ZED and vice versa? do we need to program a device seperately for acting it as router?
    2)if short address of centralite is known( from sniffer log) then will it respond to the data request if its not associated to zc?
  • For Hue, it is the same. After factory reset, it should send beacon request around 30 seconds.
  • 1. No.
    2. If it doesn't associate to ZC, you cannot send any command to device.