An example of ZHA profile and Zll profile

Source: Internet
Author: User
Tags call back

ZHA Coordinator How to control ZLL light/philips Hue Light

Abbreviation:

Zha:zigbee Home Automation Profile

Zll:zigbee Light Link Profile

Tclk:trust Center Link Key

    1. Why Zll Lamp Added Zha Network

In the ZLL network, the device supports two ways of join ZigBee network, one is through the touch link[1] mode, the remote control and the lamp close to pairing the way to pull the light into the ZLL network. Another is the traditional network, called the classic Commission joins the way to join ZigBee network. The traditional network process is as follows,

                                    

(1) The node is joined to the network as the parent node in trust Center (typically the coordinator)

(2) node joins the router as the parent node to the network

The above access process is to enable secure in the case of testing, zll lamp in the way through the classic Commission join, the parent device sends a transport key message to send the network key to the child device, the secret key is called network key, The secret key is used to encrypt the communication data within the network. When network key is sent from the parent device to the child device, it is possible that other devices will be listening to it, causing network key to be stolen, making the communication unsafe. Therefore, the ZigBee protocol uses trust Center Link key (TCLK) to encrypt the Network Key through the AES 128bit encryption algorithm, as follows. In the TI z-stack protocol stack by turning on the Tc_linkkey_join macro definition. For the security description of ZigBee network, refer to "Z-stack Developer's Guide.pdf" in the document of the TI s-stack installation directory in detail.

                                              

(3) Network key encryption/decryption process

In Zha's protocol stack, TCLK is a public key, which is mentioned in 5.3.3 in Zha specification[3]

In the ZLL agreement, the default trust Center Link key and the default TCLK of Zha are the same, in the [1] 8.1.6.2 section,

This is why ZLL's lights can be successfully added to the Zha network because they use the same tclk, and of course Philips Hue Light is no exception, and can be successfully added to the Zha network.

    1. ZLL How to add the lamp to Zha in the network

This section uses TI's Development Board and ZigBee protocol stack z-stack to let zll lights join the Zha network.

    • Hardware:

1) ZHA Coordinator

http://www.ti.com/tool/CC2530DK?keyMatch=CC2530DK&tisearch=Search-EN-Everything

2) ZLL Light

Http://www.ti.com/tool/cc2530zdk-zll?keyMatch=CC2530%20ZLL&tisearch=Search-EN-Everything

    • Software:

1) ZHA Coordinator

Z-stack Home 1.2.2 Http://www.ti.com/tool/z-stack

2) ZLL Light

Z-stack Lighting 1.0.2 Http://www.ti.com/tool/z-stack

    • Related tools:

1) Packet Sniffer Tool

Http://www.ti.com/tool/cc2531usb-rd?keyMatch=CC2531%20USB%20Dongle&tisearch=Search-EN-Everything

1) CC Debugger

Http://www.ti.com/tool/cc-debugger?keyMatch=CC%20Debugger&tisearch=Search-EN-Everything

3) smartrf Flash Programmer

Http://www.ti.com/tool/flash-programmer?keyMatch=smart%20flash%20programer&tisearch=Search-EN-Everything

4) Packet Sniffer

Http://www.ti.com/tool/packet-sniffer?keyMatch=packet%20sniffer&tisearch=Search-EN-Everything

Install the Z-stack Home 1.2.2 protocol stack to the default path.

1) Use IAR for 8051 9.10 to open the Smapleswitch project and select Coordinatoreb

At C:\Texas Instruments\z-stack Home 1.2.2.42930\projects\zstack\homeautomation\sampleswitch\cc2530db

By default, the Tc_link_join macro definition is enabled, and the Nv_restore is used to save network parameters.

Compile and download to the SMARTRF05EB Development Board,

2) Use CC debugger and SMARTRF Flash programmer to download Zlllight-zlight.hex files to zll light,hex files located in C:\Texas instruments\z-stack Lighting 1.0.2\projects\zstack\zll\sampleapp\cc253x\hex

Note: If the ZLL Development Kit is purchased from TI, it is already burned and written in the factory, so there is no need to repeat the burn.

1) Smartrf05eb power on, coordinator will suggest a ZigBee PAN network

2) ZLL light on the power, press and hold ZLL light on the button, keep >10s released, ZLL light will trigger the classic Commission join the way to start the network process.

3) Take the entire process using CC2531 USB dongle and packet Sniifer grab the package as follows,

 This way zll light is successfully added to the Zha network through the classic Commission join
    1. Service Discovery process for ZLL lamps

Although Zll light has been successfully added to the Zha network, it is now necessary to control ZLL light through Zha coordinator, including On/off,level, Color, and so on. But at this time Zha coordinator only know that there is a sub-device (Router) to join the network, do not know what this is a device, do not know what features he supports, he works on what endpoint, each endpoint support which cluster and so on. So at this point Zha coordinator need to start the service discovery process to obtain information on the application level of the device.

This Service discovery process is mainly called the ZdO layer of the relevant API functions, in the ZigBee specification 2.5.5.6 Device and Service Discovery Section [4] is also described.

1) Use active endpoints request to get ZLL light support Endpoint

When Zll light successfully enters the network, ZHA coordinator calls the Zdp_activeepreq () API to send Active_ep_req commands to zll light. ZLL Light after receiving the Active_ep_req command, the call back function zdo_processactiveepreq is called at Zdp_incomingdata, and the last call ZDP_ACTIVEEPRSP reply active_ Ep_rsp,zha coordinator after receiving ACTIVE_EP_RSP, the Zdapp_processmsgcbs function is called, and finally under Switch-case, Zdo_ PARSEEPLISTRSP to parse the message.

2) Use simple descriptor request to get ZLL light under each endpoint cluster

Through the above steps Zha coordinator obtained ZLL light work on which several endpoint, now need to request for each endpoint to get endpoint above supported in Cluster and out Cluster. ZHA Coordinator calls the Zdp_simpledescreq API to send the SIMPLE_DESC_REQ command to ZLL Light, and ZLL light calls call in Zdp_incomingdata after the command is received The back function zdo_processsimpledescreq, and finally calls Zdp_simpledescmsg reply Simple_desc_rsp,zha coordinator after receiving SIMPLE_DESC_RSP, The Zdapp_processmsgcbs function is called, and at the end of the switch-case, the message is parsed by ZDO_PARSESIMPLEDESCRSP.

3) ZHA coordinator after receiving ZLL light device announce, began to enter the service discovery process, the specific implementation of the program see the attachment code, search ZHAZLL keyword.

After the node network succeeds (Device announce), the service discovery process is initiated on the node after 1s, and after the service discovery is completed, the Joystick-center on the CC2530EB Development Board is Can be achieved on the ZLL light on/off Toggle, of course, Level,color is similar.

Philips Hue Light is no exception, and the Philips Hue Light can be controlled in the same way.


    1. Control of the Zll lamp

1) node successfully network 2) Service Discovery3) Toggle LED   test code (based on Z-stack Home 1.2.2) 8510.zcl_samplesw.zip zcl_sampleswitch.c zcl_sampleswitch.hDefine macro definitions in IAR Zhazll   Reference:

[1] Docs-11-0037-10-0zll-zigbee-light-link-zll-profile-specification.pdf

[2] 2654.z-stack Developer ' s guide.pdf

[3] Zb_afg-home_automation_profile_for_public_download.pdf

[4] Docs-05-3474-20-0csg-zigbee-specification.pdf

An example of ZHA profile and Zll profile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.