BitCloud - Zigbee HA/ZLL - Getting the BitCloud Stack to work with Quirky/Wink Hub (Solved)

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Post Edited to Remove Misinformation


I've finally, finally got this working after a lot of struggle, so I thought I'd share since I didn't seem to find much info for this application - I thought it'd be pretty common. I'll summarize what I ended up doing first to get it to work, then throw in some discussion questions.

 

Like most programming problems, most of what I did was unnecessary, and in the end it all boiled down to these points:

  • I'm using the BitCloud ZLLDemo with AVRStudio/gcc and the 'Zigbee Light' Device in the Wink App.
  • Despite the usual need for a Zigbee Alliance Master Key, it turns out you can actually pair with the Wink Hub without it. Very cool the Wink hub allows generic devices and apparently development keys.
    (The Wink Hub is a Zigbee HA device and pairs with ZLLDemo based on HA backward Compatibility - This only requires the Zigbee HA Public Key)
  • You need to be compiling/loading the 'All' or 'Router' makefile/hex - Really this was the major problem preventing me from pairing (I was using the EndDevice config).
    (This is because ZLL and HA require Lights to also be Routers)
  • For my board at least (the ATMEGA256RFR2-XPRO), I had to modify the ZLLDemo to actually work with the onboard LED.
    • configuration.h defines APP_USE_PWM for this board, but PWM doesn't appear to be configured properly to use this board's LED
    • I commented the #define APP_USE_PWM out to use Digital IO for now. 

 

This experience does leave me with a few questions about the whole thing.

  • If I apply and obtain the Zigbee Master Key, where would I use it in the context of the BitCloud framework - Which key does it replace (ZLL_PREINSTALLED_LINK_KEY, ZLL_SECURITY_KEY, CS_NETWORK_KEY...)?
    (See Solution Below)
  • Why did I have to use the Router or All makefile instead of just the EndDevice?
    (See Solution Below - ZLL and HA require lights to be Routers)
  • Have I missed anything clearly documented somewhere that would have made this easier (I can still tell myself I learned something in the struggle...)?
    (ZLL and HA are distinct standards. The ZLL Spec is helpful in addition to Zigbee and Zigbee HA specs).

 

Hope this helps others trying to develop Home Automation products. Thanks as always.

This topic has a solution.
Last Edited: Fri. Oct 16, 2015 - 12:23 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

sleepisfortheweak wrote:
Despite the usual need for a Zigbee Alliance Master Key, it turns out you can actually pair with the Wink Hub without it. Very cool the Wink hub allows generic devices and apparently development keys.
Wink does not allow development keys. Wink does not know anything about ZLL, it is an HA hub. The light joins because ZLL has a provision for backwards compatibility with HA and your device simply uses public HA key and operates in HA mode.

 

sleepisfortheweak wrote:
You need to be compiling/loading the 'All' or 'Router' makefile/hex - Really this was the major problem preventing me from pairing (I was using the EndDevice config).
This is a result of not reading the standard. ZLL (and HA) specifies that bulbs must be routers.

 

sleepisfortheweak wrote:
If I apply and obtain the Zigbee Master Key, where would I use it in the context of the BitCloud framework - Which key does it replace (ZLL_PREINSTALLED_LINK_KEY, ZLL_SECURITY_KEY, CS_NETWORK_KEY...)?
It replaces  ZLL_SECURITY_KEY in N_Security_Calc.c. But it is not easy to apply for this key, you actually need to have a product that has passed the certification and you are about to ship.

 

sleepisfortheweak wrote:
Why did I have to use the Router or All makefile instead of just the EndDevice?
because the spec says so.

 

sleepisfortheweak wrote:
Have I missed anything clearly documented somewhere that would have made this easier (I can still tell myself I learned something in the struggle...)?
ZLL specification at least.

 

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thought I should also mention I used the Atmel Wireshark Sniffer Interface with my ATZB-X-212B-USB stick to monitor and debug. Watching an off-the-shelf ZLL light bulb pair first gave me the idea to use the 'Router' makefile for ZLLDemo when I saw it pair using that profile. I've attached the Wireshark capture file from commissioning and successful On/Off control of ZLLDemo as well as pairing with a Cree Zigbee bulb in case anyone wants to look it over.

 

Note that you need to enter the Zigbee Default Link Key into Wireshark to unencrypt the transactions (5A 69 67 42 65 65 41 6C 6C 69 61 6E 63 65 30 39 from the Zigbee Pro Spec. Wireshark->Edit->Preferences->Protocols->Zigbee NWK->Edit...). This key is mentioned in the ZLLDemo headers, but doesn't seem to actually be used on the Atmel side.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

This key is a well-known key, it is preconfigured inside the stack. It actually reads "ZigBeeAlliance09" in ASCII.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexru,

  Thanks for your concise answer as always. Things are making much more sense. Sorry I apparently posted my reply while you were posting yours. I've been digging into the Zigbee and Zigbee HA specs, but still have a way to go. Like most specs, there's probably a dozen pages of key information like that mixed into over 1000 pages spread across several files. Ironically, I don't seem to actually have the ZLL spec in my collection yet... Maybe it would have been more concise for what I wanted.

 

I'm doing most of this as a proof-of-concept for potential new products at work. It's much less intimidating when presenting the project if I can immediately demonstrate a device that already functions in some way with an existing product, since that's the biggest unknown. I was afraid the whole 'Master Key' thing would stop me from being able to verify compatibility until after all the development was already invested.

 

I now understand that I'm operating in ZLL's backward-compatible HA mode. I guess that backward-compatible mode doesn't require a Master Key? Only other 'standard' HA products apply for and use it? That would seem to imply there's no need to apply for certification on a ZLL product? I imagine an explanation for this is in the documents somewhere relating to ZLL and backward HA compatibility. I'll have to keep reading....

 

Thanks again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

sleepisfortheweak wrote:
I was afraid the whole 'Master Key' thing would stop me from being able to verify compatibility until after all the development was already invested.
ZLL is kind of designed for "big guys". Companies that are committed to making a ZLL products usually have a way to request a product from another vendor with a development key in it. But that is obviously not for a hobby or small companies.

 

sleepisfortheweak wrote:
I guess that backward-compatible mode doesn't require a Master Key?
Nope, only public HA key is used.

 

sleepisfortheweak wrote:
That would seem to imply there's no need to apply for certification on a ZLL product?
There is no need if you are not making a ZLL product. But then your product won't work with Philips Hue, for example. The good news is that most of the universal hubs on the market are HA-based (Wink, Iris, SmartThings).

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow, for some reason this eluded me until now, but I'll post in case someone else gets as confused. Only ZLL uses the 'Master Key'. HA can use several security protocols, but doesn't require any special 'Master Key' key like ZLL.

 

Your previous posts were all implying this, but for some reason it took me this long to get it... Now that I'm reading the ZLL spec, it's also immediately obvious there. I guess I lacked the understanding that they're really 2 different protocols that can only inter-operate in certain ways. In this case, the ZLLDemo application recognizes the Wink Hub communicating as a HA device and begins commissioning in this backward-compatible HA mode - no 'Master Key' needed since it's not a ZLL hub. When communicating in HA mode, the 'ZigbeeAlliance09' public key is used to establish a Network Key for further comms as I can see in WireShark (the Atmel code doesn't show this key being used, but I guess it's pre-compiled in the library as you say). The light has finally really come on...enlightened (shameless pun)

 

That's actually all good news since we'd be developing mostly Zigbee HA suited products rather than ZLL ones.

Last Edited: Wed. Jul 29, 2015 - 04:36 PM