Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zigbee coordinator with Xiaomi devices

Hi all!

I found solution for Xiaomi zigbee smart home sensors (gerkon, water sensor, pir motion, and other...) based on CC2530 zigbee shepherd and Trust Center Link Key from lthis ink.

Heve anybody an idea how to implement nrf52840 zigbee light coordinator code to cominicate with Xiaomi devices?

I tried to use it, but i dont inderstand where i have to paste key in source code, when i try to join to network code return  info with unknown signal parameter....

  • Yes, Xiaomi devices are has the same link key "ZigBeeAlliance09". They are connect ing to coordinator (nrf52840 example) well (logging signal 2 - ZB_ZDO_SIGNAL_DEVICE_ANNCE and 15 - ZB_NWK_SIGNAL_DEVICE_ASSOCIATED) and i can watch packets between coord and Xiaomi with sniffer (my message above).

  • Ok. I can see that the first message:

    ZB_ZDO_SIGNAL_DEVICE_ANNCE (description from infocenter here) means that the device has joined the network. 
    The other:

    ZB_NWK_SIGNAL_DEVICE_ASSOCIATED (description here) As it it says on infocenter, this is here for historical reasons. You should use the ANNCE message instead.

     

    So could you describe in detail your exact issue? Are you not able to communicate with the devices after they have joined the network? Or is it the info with unknown signal parameters? What parameters and signal do you refer to?

     

    Do you have a light_switch in addition to your light_coordinator in your setup as well?

     

    Best regards,

    Edvin

  • Hi Amigo!
    I think it is worth to start again from a small analysis to get into the right direction.

    Generally, if you want to create a solution based on Zigbee network you have to answer three basic questions:

    1. Which commissioning method are you going to use?

    2. How a device will discover other nodes?

    3. How data will be collected or commands sent?


    The article that you have linked answers the first question – Xiaomi devices will join a coordinated network, with the default, well-known Trust Center link key.

    Although I am not familiar with French language, it seems that the article does not describe a way to discover nodes or collect measurements, but that part may be deciphered from attached traffic dumps. If you look closely, all values are sent using “Report Attributes” command, addressed to the node “0x0000”, which is always the coordinator. That should answer the second question – there is no need to discover nodes, because they seem to report data to the coordinator without additional configuration (unless something was removed from traffic dumps).

    This quick analysis also answers partially the third question: value changes are reported by nodes, so there is no need to explicitly read them from every device. In order to parse those messages you probably should register a ZCL Report Attribute callback. Unfortunately currently there is no example that facilitates Attribute Reporting inside the Zigbee SDK, apart from the code snippet inside infocenter.

    I hope this analysis will speed up your development Slight smile

    Kind regards,

    Tomchy

  • Hi Amigo,

    Earlier today, with one of my colleagues, we have confirmed that it is possible to get data from Xiaomi devices using Zigbee SDK!

    We have chosen a very similar, maybe a little more complex way to achieve that. We just got the coordinator example and applied following changes:

    - register an endpoint callback on the first endpoint

    - parse ZCL headers and look for attribute reports

    - log incoming values

    The earlier proposed solution should also work and require less code, because incoming  ZCL packets should be filtered by command ID inside the stack.

    Regards,

    tomchy

  • About first solutoin... I have to add into coordinator code init part   ZB_ZCL_SET_REPORT_ATTR_CB(&report_attribute_cb);

    Then add function: zb_void_t report_attribute_cb(...)  and declare endpoint? (how to do it right?) 

    couldn't you give me an example of you code, i noobie with zigbee?))) 

Related