Zigbee - from flakey to stable

The suggestion came from @tpmanley in an earlier post in this thread:

The adjustment of these values seems to be needed in order to avoid Xiaomi devices from dropping their connection due to End Device Aging as also described by @tpmanley here:

Long story short, the ST Hub has an End Device Aging timeout that’s shorter than the check-in interval of Xiaomi devices (50 or 60 minutes depending on whether the device is an Aqara model or not). When the Xioami device doesn’t check in soon enough, the ST hub “forgets” that device (drops the connection) and if the device tries to check-in after that, the hub asks the device to leave and rejoin the network. For some reason, Xiaomi devices leave the network but don’t rejoin. So the user see that the ST hub has lost the connection with the device.

Between several hub firmware updates last year, the ST hub first didn’t send the “leave and rejoin” message to devices that didn’t check in often enough, and then the hub did send the message, and then the behavior seems to have reverted to not sending the “leave and rejoin” message.

However, XBee modules operate on a different set of default parameters than the ST hub, with different naming conventions than the Zigbee specification, because (depending on the model) the modules can either be set up for use with a Zigbee network or Digital International’s Digimesh network. So we need to adjust specific parameters on an XBee module to get it to “play” well on a ST Hub’s Zigbee network, and also a couple of parameters (SN and SP) to work with the limitations of Xiaomi devices if you have any. This is because the XBee will also send the “leave and rejoin” message if a device hasn’t checked in before the XBee’s End Device Aging Timeout (known as “Child Poll Timeout” by Digi in the XBee documentation), and we want to avoid “leave and rejoin” message, knowing the Xiaomi device won’t rejoin as requested.

If you mean your SmartThings hub, then no, because it doesn’t have an SP parameter. @tpmanley might be able to answer what the ST hub’s End Device Aging Timeout is. But his suggestion of setting an XBee router’s SN parameter to 0xAF0 and SP to 130 calculates out to a timeout period of a little over 3 hours, which should be plenty (as he states) for a Xiaomi device that checks in every 50 or 60 minutes.

That said, I have seen cases in my testing where after being initially paired or manually rejoined to the network, some of my Xiaomi devices did not check in for 1 or two hours. So in other words, they missed their first couple of check ins. The surest way that I know of to confirm that a Xiaomi device has checked in is to look for a battery percentage report event. Those happen at the same time that Xiaomi devices check in. Keep in mind that a Xiaomi device will happily send open/close, motion detected, temperature, etc. reports even though it’s not checking in, but that will all stop when the hub (or router) asks it to leave and rejoin due to the End Device Aging Timeout.

I know this thread is not supposed to be about Xiaomi devices specifically, so I will say that there could possibly be device timeout issues with other Zigbee devices, and also that by extending the timeout period on an XBee module through changing the SN & SP parameters, you may be obscuring issues with devices that are dropping their connection due to a weak mesh network (low signal strength due to distance / obstacles).

2 Likes

As JDRoberts has mentioned more than once, Xiaomi uses a different protocol that SmartThings, and if you use these devices and are looking for any kind of stability, you are opening yourself up to a whole world of pain. But as he also says, people are different. I guess people’s definition of “fun” varies considerably.

1 Like

Wow what a difference these two sleep settings have made.


As previously mentioned I hit 32 device limit and when I added more Xiaomi devices paired to the xbee routers they showed up as routers themselves and stayed connected for a few hours before dropping off. With 90% connecting to the coordinator (hub).
Before:

I have applied these settings to my routers and as you can see the devices all show up as Endpoint now (OK except 1) and have distributed themselves far more evenly etc, and they are stable.

Thanks all !
I just need to add my remaining devices now this looks to work.

4 Likes

Hi Everyone, I am making my own sensor that happen to be a zigbee router as well. I am curious whether my sensor can also help with xiaomi devices. I have paired one Xiaomi Aqara Motion sensor. I also forced it as a child of my sensor. It has been a day. I have not seen any issue.

Can you guys help with information on how long typically xiaomi devices dropped out the network when connecting to incompatible zigbee router? Is the issue typically seen an days or hours?

Is there any Xiaomi devices that worse than the other? I like to get them because I would like to test it.

Thank you. Please let me know what you can share.

It seems to me that Xiaomi Aqara send its battery status every 45 minutes. In the meantime, I also make sure that it detect no movement to catch the aging device symptom.

Here is the map of my test setup.

This is the second day it reporting battery. If DIY router is incompatible/compatible, Should I be waiting for another day or two for confirmation?

Managed to improve the reliability of my Xiaomi devices connection with the ST Hub by adding a Xbee radio module (Xbee Non-Pro Series 2 for Zigbee) into my Smartthings zigbee mesh network.

I am new to using the Xbee with Smartthings, and used the extremely useful information provided by the many experts in this thread (especially with info from @adam_walker, @Falcogeorge, @TN_Oldman, @veeceeoh, @tpmanley, @nowon)

The following a compilation of the info gathered from this thread with some added details to fill in the gaps for newcomers to this thread, and with some details from the various other sources. This compilation may help newcomers to this thread who want to install a Xbee radio module as a router between the Xiaomi devices and the ST Hub.

PROBLEM
Unreliable Xiaomi devices connection with the ST hub.

ROOT CAUSE
@veeceeoh described the cause and solution very well

THE IMPLEMENTATION
Installed a Xbee radio module as a zigbee router to be a “middle-man” connected between my Xiaomi devices and the ST hub.

Purchased the Hardware

The hardware was purchased from a local electronics shop in Singapore.

  1. Bought a XBee XB24CZ7WIT at SGD$38.00 (About USD$27 at current rates - Probably could find cheaper ones online, but it was convenient for me to visit a local shop and get it immediately). As with the findings from the others in this thread, I did not need the Xbee Pro version, the Non-Pro XBee version I bought worked with Smartthings. The above model I used was a Xbee X2C Non-Pro Series 2 for Zigbee with a Wire Whip antenna.

  2. Bought XBee USB Adaptor that came with a USB cable at at SGD$14.00. (FYI - The Xbee USB Adaptor I purchased did not come with an On-Board Reset button. For the task that I was doing to Pair the XBee with the ST Hub, I did not need to perform any reset on the Xbee. If a reset was needed, I had planned to short Pin 5 and Pin 10 to initiate a reset).

    Plugged in the Xbee to the Xbee USB Adaptor and ensured that it was the right way up.

  3. I also bought a small plastic project box for SGD4.90 to protect the Xbee. Used one of the corner screws on the box to secure the Xbee to the box. Could have done this myself, but again for convenience, obtained services from the shop to drill an opening on the box for the USB connection for SGD$2.

Installed the FTDI driver for Windows 10 PC, and plugged in the Xbee to the PC via USB

  • Prior to plugging in the Xbee to the PC using USB, installed the FTDI Driver - This helped to detect the Xbee upon plugging in to the Windows 10 PC. Went to FTDI website, downloaded and installed the FTDI driver for Windows 10 at http://www.ftdichip.com/Drivers/D2XX.htm. I used the setup executable link found in the comments section. See the image below

  • Connected the xbee to the PC using a USB cable.
    Windows 10 detected the XBee and used the pre-installed drivers.

Opened the XCTU software and found the Xbee Radio module.

  • Downloaded and installed the XCTU software and manual for my Windows 10 PC. The XCTU software was found at the Digi website at https://www.digi.com/products/xbee-rf-solutions/xctu-software/xctu. In case a reference manual is needed, The XCTU Manual was found at https://www.digi.com/resources/documentation/digidocs/pdfs/90001458-13.pdf

  • Opened XCTU and did a Discovery Scan to find the Xbee Device. After opening XCTU, clicked the Discover Device icon (this is the right icon that has a magnifying glass). Selected to search All ports. When the baud options were presented, I used 9600bps, and selected all the default options. Clicked Finish to initiate the discovery scan. When found, selected the Xbee device found, and clicked the Add Selected Device button

Updated Xbee firmware
Decided to redo the Xbee configuration by clearing all the previous configurations with a firmware update. I had earlier entered different parameters from different sources, and somehow even when the parameters looked right, it just could not be discovered by Smartthings.

  • Used XCTU to update the Firmware. Selected Configuration Mode (the Gear Icon on top), then selected the Xbee from Radio module list on the left. Clicked the Update Firmware button. A dialog box appeared displaying the available and compatible firmware for the selected module.

  • Chose the firmware family, function, and version. Selected Product Family: XB24C, Function Set: ZIGBEE TH Reg, Firmware: 4060, Disabled “Force the module to maintain its current configuration” to clear all previous configurations. Clicked Update.

Configured Xbee Radio Module Parameter Settings

  • Selected the Xbee device. Selected Configuration Mode (the Gear Icon on top), then selected the Xbee from Radio module list on the left.

  • Updated the device with the parameters with the list below, the remaining parameters were left with their default values. Changed the value of the setting to be configured, and Clicked on the Write button found beside each parameter to write the newly configured value to the module.

    Tried several other parameter suggestions, but these worked for me and allowed my Xbee to be discovered by the ST Hub. Thanks to TN_Oldman’s post found at DIY Programmable XBee (S2B,S2C) ZigBee integration with SmartThings

    Also Added the SN and SP for Sleepy Xiaomi - thanks to Tom Manley and Veeceeoh, found at Zigbee - from flakey to stable

      ZS = 2
      NJ = 5A
      NI = Entered "My XBee" for the name 
      NO = 3
      EE = 1 (Enabled)
      EO = 1
      AP = 2 (API enabled with escaping)
      AO = 7 (Exlicit+ZDO)
      D8 = 0 (Disabled)
      D6 = 0 Default (but D6=1 somehow worked as well for me)
    
      SN = AF0
      SP= 130
    
      KY = 5A6967426565416C6C69616E63653039
    

    KY is the Smartthings encryption key. For me, the KY data was not displayed when the Xbee radio module was later disconnected and re-connected back to XCTU. But KY data appeared to work still, and probably not displayed as designed for security reasons. KY data seems to be persistent and is preserved through power cycles.

Added Xbee as a Thing to Smartthings

  • In the Smartthings App, tapped Add Device to begin the discovery. The device was discovered, and displayed on the App. Tapped Rename, and renamed it as “My XBee”.

    (Because the previous parameters didn’t work for me, I was glad to see the xbee finally discovered by the ST Hub! )

Note 1: The Xbee device did not need a Reset to join or to pair. Upon selecting add a new thing, Smartthings discovered and displayed the Xbee as a new Thing

Note 2: Xbee device appears to retain its settings with power cycles

Joined Xiaomi Devices with Xbee
Used the advice below from veeceeoh to join the Xiaomi devices with the XBee

With the advice from above.

  • Placed the Xbee in a location between my Xiaomi Devices and the ST Hub. The Xiaomi devices will pick the parent with the strongest signal. For my setup, I placed my Xbee device in a location between my ST Hub and the Xiaomi devices. Because the new Xbee is intended to help with the sleepy devices, it was important for the Xiaomi device to pick the Xbee router and not the ST hub as the parent.

  • Paired Xiaomi Devices with Smartthings. In the Smartthings App, tapped Add Device to begin discovery. For each of my xiaomi devices at it’s installation location, I then paired the devices. Each Xiaomi device was discovered, and displayed on the App. The intention of the pairing was to connect to the ST Hub through the Xbee Router. I subsequently did a scan to check.

  • Confirmed that the Xbee radio module was a zigbee router as a “middle-man” connected between my Xiaomi devices and the ST hub. In XCTU, Selected Network Working Mode (Click the Network Icon on the top right), then selected the Xbee from Radio module list on the left. Clicked Scan.

    The scan showed that the Xiaomi devices (End-Point) were connected to the Xbee (Router), and the Xbee was connected to the ST Hub (Coordinator)

Instead of the previous daily disconnections, the Xiaomi devices have since been operating reliably now for the past 3 days. Hopefully it continues…

14 Likes

Great write up. That will be VERY helpful for others.

Thank you. One of these settings made my network scan start working properly. Now it picks up all the It was either AP, A0. Before it took me hours to see devices past my sylvania routers but since i made the changes based on your recommendations after 20 mins or so I see everything show up.

What Sylvania product are you referring to? Someone just commented in another thread that his Sylvania Zigbee outlet wasn’t repeating, and that Sylvania confirmed that they don’t, so I dropped them off my list to look out for…

There are two versions of the sylvania plug. One works the other doesn’t. Unfortunately the only way to tell was to look at the model number on the back. I went into a local store that had them and verified the model number first before grabbing 4 of them for my setup and they are working. Another person I talked to said they ordered of amazon and got the non working model.

Sylvania Smart Plug 72922 is the one the works. The other model I believe has a -A at the end and that is the non working model.

This is a link to the product but I can’t say for sure if you order this which one you would get.

More info can be found at this thread.

1 Like

Hi
ever since xctu updated to 6.4
i cannot program this devices
are you experience the same?

Haven’t been on this thread in a while - but just saying that @tpmanley ‘s pointer on sleep settings just fixed things for me - that little last tweak. Ihaven’t had a xiaomi drop in months when connected to my Xbees - and of course huge kudos to @adam_walker for this great guide to begin with. Xbees are cool and the fact that you made them accessible is even cooler!

Where are you guys finding them for this price? I’m in the US and that should be around $7-8 for 2 and $2 for the usb converter?

But all I can find are $27 xbees and $14 usb adapters. That’s a huge price increase.

Actually, I am also looking for same information. How people are finding these cheap? Would give a try if comes around $7-10. I am not on the edge so I can wait if I need to.

Phil, for reference that is the kit that I’ve purchased in the UK from Farnell/mouser as I couldn’t find the XBee modules particularly cheaply and the issues that everyone has mentioned around the USB adapters being hit and miss so thought this was a reasonable way of getting a working device.

Just got the first one loaded with the ZIGBEE TH Reg firmware opposed to the 802.15.4 that they come with and programmed with the settings as pulled together from the thread in @gswoosh’s post #175, it’s paired successfully with Smartthings and mapped my ZigBee network.

Now to get it in a suitable case to put out between the SmartThings hub and the garage where I’m trying to use some of the Xiaomi Vibration/Motion Sensors.

Did anyone get a DH working with the XBee’s?

Thanks to OP and everyone that’s contributed to this!

If your using Xiaomi devices, you might be interested in this thread.

I have unplugged my Xbee’s since aquiring two of these devices.

2 Likes

Thanks Don, I am but the XBee I’ve configured is doing the job of keeping the sensors out in the garage connected up.

Out of interest why have you moved from the XBee to the other device for ZigBee repeating/router?

@Bahubali @xamindar

I’ve found the same model XBee’s that @adam_walker was using at the beginning of the thread here, got two for £7 as the power output is higher on the Pro’s: https://www.ebay.co.uk/itm/DIGI-INTERNATIONAL-ZIGBEE-MODULE-XBEE-PRO-ZB-PCB-ANT-XBP24-Z7PIT-001/173543583604?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

However I’ve not been able to get the XBP24-BZ7 to play with the SmartThings Zigbee network unlike the newer ones I started with. @adam_walker any chance of getting a copy of your config file to try?

Scan of my network below, the Green Router is one of the ZBee S2C’s that came in the Digi Connectivity Kit, working a treat and keeping the Vibration Sensor in the garage connected. The XBP24-BZ7’s is the ? device connected to my laptop and running the scan from XCTU it’s showing as Type: Unknown but is configured with the same firmware that @adam_walker was running and the settings as per the thread above apart from AO as don’t have option 7 available only 0,1,2,3. It also isn’t found as a thing by SmartThings so there’s something not right somewhere, any pointers would be gratefully received.

2018-11-09_21-13-12

I originally got one of the above mentioned sensors as a test. It works very good at what it is supposed to do.

I’d say the main reason it it’s a plug and play solution. I do like messing with the Xbee. This sensor just plugs in and does its magic.

Also it has other sensors on board to give you extra data. It tells you things like light levels, temperature, pressure. Makes them available to smartthings environment for use.
I like that it tells me the number of devices connected through it. Easy to see if my shed sensors are routing at a glance.

Since I’ve installed my environment sensor he has modified and created newer version with even more options.

Hope that helps.

3 Likes

I believe you can select AO = 3 it should be the same as 7 in some firmware versions. Your looking for this setting “Explicit+ZDO”

I am sure you have read these 2 threads but there is a bunch of information on Xbee and some of my own experiences with them to possibly help you.

I know when 1 was having issues getting smartthings to see my module it was a setting for " I think parameter D6" been a while since I have messed with these.

I have also had to load the default firmware and power cycle Xbee, Then load the firmware I wanted to use and reconfigure all the settings again to get it to connect again once it had before.

It can be a frustrating process.

Hope that helps you.