Zigbee network optimization: a how-to guide for avoiding radio frequency interference + adding Zigbee Router devices (repeaters/extenders) to get a stable Zigbee network mesh with best possible range and coverage by fully utilizing Zigbee mesh networking

If you want the best setup that does not cost much more then highly recommend instead getting three (or more) Sonoff ZBDongle-P or Sonoff ZBDongle-E adapters to use in USB-chargers for power after converting them into dedicated Zigbee repeaters / range extenders by flashing Zigbee Router firmware.

While IKEA Trådfi Signal Repeater is good (and better as a dedicated Zigbee repeater / range extender than for example the IKEA Trådfri Control Outlet), the CC2652P and EFR32MG21 based ones with external antenna like those Sonoff ZBDongle-P or Sonoff ZBDongle-E adapters work great as dedicated Zigbee repeaters / range extenders, best of the best!

If that does not help then recommend reconsidering changing to other Zigbee channel (as well as taking all the other suggested best practice actions to avoid interference that are listed in my original post).

hmm, you can change the Zigbee channel in ZHA integration without having to re-pair ALL devices. I do not know how Zigbee2MQTT has implemented changing channels, perhaps Z2M developers have not yet implemented broadcasting of channel change which gives the devices a heads-up that the channel will change, (it could also be that it is old or wrong information as it is possible in most Zigbee solutions, and while not all Zigbee devices support changing channels without re-pairing, most devices do).

Anyway, the fact is that most Zigbee Router devices (mains-powered products) should handle switching Zigbee channels and will usually reconnect themselves automatically within 1-hour or so and you can even force that process to go quicker by power-cycling devices. It is normally just the Zigbee End-Point devices (e.g. battery-powered devices) that will be re-paired/re-joined. You should not lose any configuration or data as long as you only re-pair/re-join the device and do not remove the device from your Zigbee gateway solution.

No (that is not how Zigbee is designed to work), but many Zigbee gateway solutions do at least perform an energy scan on the initial setup and pick the least congested channel at the time of creating the network.

You also have to remember that practically almost all commercial Zigbee gateways/bridges/hubs from companies only support a limited set of specific Zigbee devices that they have certified for their Zigbee gateway/bridge/hub, and most only support devices from their own brand, meaning that you can just buy any device with a Zigbee logo on the box and expect it to work.

If using Home Assistant then the only Zigbee solutions I would even consider for a fresh installation are the ZHA integration or Zigbee2MQTT, (and deCONZ/Phoscon also works good if migrating from another ecosystem that used it, however, I would not personally recommend it today for a new installation).

Yep that sounds very plausible. Be sure to connect all your WiFi access-points and other devices to Ethernet if possible. IIRC I am pretty sure that was one of the tips in my original post above :stuck_out_tongue:

Most such WiFi solutions that assign channels automatically tend to primarily use WiFi channels 1, 6 and 11 so suggest try changing to Zigbee channel 25 (as many devices do not support Zigbee channel 26).

Obviously, you always also want to locate your Zigbee Coordinator and all your Zigbee devices as far away as possible from your WiFi access-points and any devices that use Wi-Fi, regardless of setup.

Here is by the way good article explaining this is Zigbee and Wi-Fi Coexistence → https://support.metageek.com/hc/en-us/articles/203845040-ZigBee-and-WiFi-Coexistence

hehe, you do not have many devices now, so will feel much worse later when you have loads more :wink:

If you want to keep your Google Nest Wifi then you got to be willing to work around its limitations.

I have owned a similar WiFi solution myself in the past and learned my lesson of not doing enough research, so sold it before owning it even for 1-year and bought UniFi APs from Ubiquiti, no regrets.

1 Like

@macottom I am going to answer you here in this other thread since the reply was more relevant here.

You asked several questions in your thread titles “Stock sonoff Zigbee 3.0 stick” but answers to those questions are really general to all Zigbee Coordinator adapters and Zigbee Router devices in general.

Highly recommend reading all the tips my original post in this thread → Zigbee networks: how to guide for avoiding interference and optimize for getting better range + coverage

Yes your Zigbee devices will resolve all network routes by themselves automatically, but you need to be aware Zigbee relies on network mesh technology and all deceive signals are very weak, so you can not only add Zigbee end-point devices to your network as those will not help route any traffic or extend the range and coverage. Instead, you need to add products that also act as Zigbee Router devices (which most mains-powered devices are) as those will route the traffic from other devices to build out your Zigbee network, extending the range and coverage

I personally do not recommend buying Zigbee lightbulbs that act Zigbee Router devices unless you remote the dumb switch that can turn of the power, because your Zigbee network expects that all your Zigbee Router devices are always available and therefore a Zigbee end-devices connected indirectly through a Zigbee Router device usually takes 1-hour or longer to reconnect (and some Zigbee end-devices with buggy firmware will sometimes never reconnect to other Zigbee Router devices than it was initially paired with).

If you want to control ceiling lights then a better option is buying smart Zigbee switches and/or dimmers to control dumb lightbulbs (though you might need to also buy other dumb lightbulbs if get dimmers).

If you are just starting out I suggest you consider buying a few dedicated Zigbee Router devices. Again, recommend try follow this extended guide to get started with a best practice setup/environment from the very beginning → Zigbee networks: how to guide for avoiding interference and optimize for getting better range + coverage

It depends which model you bought and firmware used, but in general most modern Zigbee Coordinator adapters (like those based on CC2652P/CC1352P and EFR32MG21 SoC radios from Texas Instruments and Silicon Labs respectively) can handle controlling around 100-200 Zigbee 3.0 devices (depending on your setup and environment) or thousands of older Zigbee devices that are not using Zigbee 3.0 security features, (the reason they can not handle more Zigbee 3.0 devices is that it has a higher security overheard and the current generation of SoC radios do not have enough RAM, so that could be higher with newer Zigbee radio SoCs in the future). Regardless of which Zigbee Coordinator adapter radio is used, they can not connect to all devices directly, you are going to have to add Zigbee Router devices to extend the maximum number of devices that can be added to your network.

ZHA docs explain most need to know about how Zigbee works (like how it depends on mesh network):

Especially read and try to understand all in these sections from the ZHA integrations documentation:

If nothing else then avoiding interference remember network mesh is the key and simply adding more and more Zigbee Router devices to your network will make it more and more robust.

PS: Note that ITead sells two Sonoff branded Zigbee dongles/adapters that are based on different radios. For more details see the existing threads about Sonoff ZBDongle-P and Sonoff ZBDongle-E:

2 Likes

thank you for your detailed and informational answer… i was a smartthings guy and had about 25 zigbee devices… life was good, but i wanted more… so i’ve hit a wall at 32 devices in my HASS setup… i’ve been reading… watching videos… and there was much i didn’t know! at this point, i’m expecting 4 smart plugs/repeaters from Amazon today and have basically deleted all but a few of my zigbee devices and am going to start from scratch once the repeaters are paired… I’m anxious to get some hands on with it using the additional capabilities…!!

I did order a pack of two Sonoff ZBDongle-P but in the mean time I moved the RPi from the opposite side of the house to the kitchen where most of my devices are.
That did not make any difference, so I decided to go ahead and change the channel from 11 to 25. I tried that before but I was trying to save time by not re-pairing all the devices - it looked like the devices were connected again but the lag was still there so I changed it back to 11.

Next day I decided to do I properly, I changed the channel again to 25 in Zigbee2MQTT, I had to delete the coordinator_backup.jason file and then re-pair all devices but now it’s working perfectly again!
I also put the USB coordinator on an extension cable but I’m 99% sure the channel 25 was the solution - it should be the default one!
In that case I don’t these the Sonoff repeaters and I’m sending them back, that saves me £40.

Yep, that was it, thanks so much! I didn’t want to do this because of re-pairing all devices but looks like that was the best thing to do.

Yes, I always prefer a wired connection over Wi-Fi :+1:t2:

Yup, that was it, thank you!

I did some research and I was going to invest in Ubiquiti as well but I found people complaining about the lack of parental controls: https://community.ui.com/questions/Feature-Request-Parental-Controls-for-the-UDM/9e9dce1e-9e85-4181-aa65-1b630c62668e?page=1
With Google Wi-Fi I can just pause the internet access on a specific device or group in a few taps via the iOS app - it works well :ok_hand:t2:

Tip is to research each new device before you buy as some are known so the community can say if it is bad Zigbee Router devices that do more harm than good if they do not pass along all messages. See:

https://www.home-assistant.io/integrations/zha/#best-practices-to-avoid-pairingconnection-difficulties

https://zigbee.blakadder.com/search.html

https://www.zigbee2mqtt.io/supported-devices/

The is as very good reason it is not the default. Zigbee channels 11, 24, 25, or 26 are commonly only supported by relatively modern Zigbee hardware devices with newer Zigbee firmware, so be aware that if using any of those channels then your coordinator may not be usable with some older Zigbee devices. Almost all solutions use Zigbee channel 15 as the default because it offers the best compatibility with old Zigbee devices as well it offers less chance of interfering with the most commonly used Wi-Fi channels compared to the other Zigbee channels that offer the same compatibility with old Zigbee devices, (that is why if possible it is generally much better to change the Wi-Fi channel on your WiFi access-points then to change Zigbee channels).

Again, adding more Zigbee Router devices is still recommended. Zigbee network will become more robust as add more and more Zigbee Router (ZR) devices, but those don’t all have to be dedicated.

That is why many people instead choose to only buy a couple Ubiquiti’s WiFi access points (which price is surprisingly reasonable) and just use them in stand-alone mode using a separation of concerns design principle approach in which modem, router/firewall, and WiFi access-points are separate devices (instead of an all-in-one that will be Jack of all trades, master of none), so then you likely want to use them in combination with some other flexible router/firewall solution like for example something like the Firewalla product series if want an easy to use router/firewall with parental control features, (someone else might alternatively prefer pfSense and OPNsense if they wanted a DIY router/firewall that is extremely advanced). Combining a few Unifi Access Point WiFi 6 Lite with a Firewalla Purple or Firewalla Gold (together with maybe an UniFi Lite 8 PoE switch for wired devices and Power-over-Ethernet to the WiFi access-points) is a very powerful yet relatively user-friendly solution if want the best of both worlds on a budget. Check out this review with a similar setup:

https://go.indiegogo.com/blog/2022/04/firewalla-purple-honest-review.html

Tip is that you get the Firewalla Gold series then it can run Unifi Controller as Docker container image:

https://help.firewalla.com/hc/en-us/articles/360053441074-Guide-How-to-run-UniFi-Controller-on-the-Firewalla-Gold-Series-Boxes

Anyway, it is sadly true that while Ubiquiti’s UniFi gateway/firewall router feature set does have Network Traffic Management and Traffic Rules for blocking sites/services, it does unfortunately not yet have any real Parental Control features for easily blocking access based on the time and day, etc., (though there are workarounds, and being a parent myself and had an Unifi Dream Machine for many years now I first selected to simply set up a dedicated SSID for the kids and automating times to turn off and on that whole SSID by temporary disabling/enabling it with the UniFi Network integration for Home Assistant, however, that workaround will not work if have large age differences between your kids as UniFi APs are currently limited to only four SSIDs, but once a kid gets their own cell/mobile-phone they quickly figure out how they can use it to get around blocks so then the only solution I found was to take their device when we do not want them to use it).

I believe the reason why Ubiquiti’s UniFi gateway/firewall router functionality is missing Parental Controls is that their product lines have never really been meant for home users and instead their target audience has in the past always primarily been commercial installations, at least until Ubiquiti more recently released their non-Pro “UniFi Deam Machine (UDM)” all-in-one WiFi-router so hopefully the feature set for the Dream Machine series might change in the future because of that product.

Well that want way too much off-topic, so I will stop discussing alternative WiFi solutions in this thread.

I would have loved to see/read this summary before I waisted money on ZigBee/matter devices! Wasted so much (specially time) to learn this the hard way!

I don’t know if it is because ZigBee only uses polling but esphome wifi devices with local push just perform on a completely different level! I will stick with them!

FYI, Zigbee devices does not only use pulling, it uses both local push and local pull as I understand it. ZHA uses push when you change state and pull when you check something like power monitoring, so I know it is confusing that the ZHA integration say that it uses pulling but by that they only mean that the the integration uses pulling however it also uses pushing too depending on the command. I asked if ZHA developers cpuld clearify this in the documentation, see → Is the ZHA integration only "Local Polling" or also "Local Push" depending on the device? · Issue #26125 · home-assistant/home-assistant.io · GitHub

Zigbee performance is exellent and respose time is instant if you do not have serious interference. But if you have serious interference then messages will need to be resent which causes delayes and latecy, as such if you see delays then that is usually a symtom of interference.

Then you just to have to deal with the fact that you need enough Zigbee Router devices for proper coverage and range extension which will depend on building materials, floorplans and location of the devices. Proper setup and good Zigbee devices give you instant responce with no latency or delays. So that can be a problem when starting out with only a few devices in a large home, especially if the user did not know about this and only bought battery operated devices (which will always be end devices) and no mains powered devices (which in most cases will be router device).

Also not be unfortunate to have a buggy rouge Zigbee Router devices that pass along all messages but that is a different issue for a seperate thread. If you have a device with such buggy firmware that is a Zigbee Router devices but do not pass along all messages then you can see intermittent issues which can be very hard to troubleshoot if you also have interference too. Howveer if you already do your best to avout interference and have at lest a few ”known good” Zigbee Router devices then it will be easier to get help with troubleshooting as you can share diagnosics logs that are not also filled with other symtoms from interference as well.

2 Likes

I started my HomeAssistant setup with a Raspberry Pi 3B along with a Sonoff ZBDongle-E. That eventually bogged down with not enough memory. The Zigbee network had around 60 devices attached.

I replaced it with a PoE HomeAssistant Yellow, which has a built in Zigbee Antenna. The network has now grown to 123 devices. The network still has occasional issues, I wonder if the built in ZigBee antenna is part of the problem. Are there any guides for replacing the internal antenna with a Sonoff ZBDongle-E ?

Hello, me again. :rofl:

You’re right in thinking that the signal strength of a built-in antenna is likely to be weaker than that of an external dongle, however in a Zigbee network the strength of the coordinator’s signal is not really relevant as it only ever connects with a small number of devices.

All zigbee signals are weak by design. The significant factor is the number and distribution of the routers. Messages don’t just need “a path” from a to b, they need many, many paths and the route they take may be different every time - they’re bounced around depending on factors like traffic, changing interference etc. etc.

In your other posts you didn’t mention that you have 123 devices! More routers!

2 Likes

Hi,

I’d agree that as ZHA controls a mesh network, the range of an individual device is totally irrelevant. What is important is that there are enough mains-powered routing devices to give more than one path between nodes - a mesh.

You’d think 123 devices would be enough, but my suggestion is to move more mains powered routers close to your Yellow. Cheap IKEA TRÅDFRI mains switch sockets work well.

The Yellow has one of the best Silicon Labs chipsets, but with a small PCB antenna rather than the larger monopole on the likes of a Sonoff USB.

I’ve posted before that he Yellow PCB does have unpopulated J9 IPEX / U.Fl connector bottom left , but I doubt there’s a simple way to switch the coordinator antenna inputs even if your SMD soldering is up to the task.
If this helps, :heart: this post!

2 Likes

FYI, the Sonoff ZBDongle-E and the SkyConnect are both based on the exaxt same EFR32MG21 SoC chip, and either will handle around 200 Zigbee 3.0 devices (or many more older Zigbee devices) as long as you just add enough Zigbee Router devices. So lack of memory should not be a problem for you if you add many more Zigbee Router devices. Read and follow the original post above.

This is also summerized in the ZHA docs here → https://www.home-assistant.io/integrations/zha/#using-router-devices-to-add-more-devices

1 Like

I’m a bit confused by the numbers you quote. As I understand, the physical limit if a single zigbee network v3.x or older is 64,000 nodes. Why would you think that you could have more devices with firmware older than 3.x attached to the coordinator you cite as compared to 200 zigbee 3.x devices attached?
‘200 Zigbee 3.0 devices (or many more older Zigbee devices)’

Below is a video of a group claiming to show over 10 years ago, to have 1,000 devices connected to a single coordinator. I have no deeper knowledge of this example or it’s layout.

It it because of the much larger security overhead of Zigbee 3.0 compared to older Zigbee protocols such as Zigbee Home Automation 1.2 and Zigbee Light Link 1.0 which does not have overhead when adding more devices. So you have to understand the different RAM footprint overhead between Zigbee 3.0 devices and older devices.

The main bottleneck is the RAM memory on the SoC and Zigbee 3.0 devices connected to a native Zigbee 3.0 Zigbee Coordinator will use higher security level (encryption, etc.) which takes up a larger footprint in RAM per device.

So the fact is that if you only connect newer Zigbee 3.0 devices then the Sonoff ZBDongle-E and SkyConnect baded on EFR32MG21 will run out RAM after connecting abond 200 Zigbee 3.0 devices, but if you instead use older Zigbee devices (i.e. Zigbee Home Automation 1.2 and Zigbee Light Link 1.0 devices) then you can connect several thousands of such devices as they do not use much RAM, and obvoisly a mix of newer and older devices will result in a number in between.

Future SoCs such as the EFR32MG24 feature more RAM and faster CPU so they will be able to handle more Zigbee 3.0 devices than EFR32MG21 that have less RAM.

Alternativly if you are willing to sacrifice security then you can get around this by connect your Zigbee 3.0 devices to a older Zigbee Home Automation 1.2 Coordinator (like example ConBee 2) as then all devices will connect in backwards compatible mode and not use the Zigbee 3.0 security.

So yes, you can connect thousands of Zigbee devices, but not if they are native Zigbee 3.0 devices connected to a native Zigbee 3.0 Coordinator like EFR32MG21 based adapters are.

That is a theoetical limitation if you had unlimited RAM and CPU resources on the Zigbee Coordinator SoC, while in practice with newer Zigbee 3.0 security overhead you will run out of RAM and CPU (especially RAM) on even the latest Zigbee Coordinator SoC.

To futher clearify, you will run out of RAM on the SoC long before you reach that limit and after that you run out of CPU on the SoC. Thus the RAM and CPU on the SoC is the bottleneck if want to connect more Zigbee 3.0 devices, which is why we can look forward to newer Zigbee Coordinator adapters based on example the new EFR32MG24.

Yeah, those are not Zigbee 3.0 devices connected to a Zigbee 3.0 Coordinator. Zigbee 3.0 devices only started to become available on the marked in 2016 by early adopter manufactuers and most other companies did not start to release Zigbee 3.0 devices until around 2019. So chance is that if you have a Zigbee device that was released more than 5-years ago then it is not a Zigbee 3.0 devices.

Alao note that the popular ConBee 2 and RaspBee 2 are not Zigbee 3.0 Coordinators so all devices will connect to them in backwards compatible mode and that is why you can connect more Zigbee 3.0 devices to them than you would expect to a older Zigbee Coordinator, but again you sacrifice security when you do so. (It is like connecting an newer WiFi device to an old WiFi router / access point where they can only connect to the newest protocol version that share).

6 Likes

Hi. First of all, thank you for your work!

Unfortunately my NUC only has USB 3 ports. Therefore, I bought a multi-shielded USB 2 extension cable with a length of 3 meters and removed my Sonoff Dongle-P from the range of the NUC.

Is this USB 2 cable enough, or is it better to use an additional USB 2 hub in between to exclude possible interference from USB 3? I previously thought the cable automatically reduced the signal and therefore possible interference?

The second question concerns the antenna of the Sonoff dongle. I have read that it can be helpful to connect another alternative bigger external 2.4Ghz antenna to this to improve network range and stability. Are there any suggestions for such an alternative antenna? There are so many antennas on the www that I lost track.

Thanks in advance.

I understand that people have tested and report less interference via USB 2.0 ports on a USB 2.0 hub. Since the radio adapter dongles are only USB 2.0 capable it will never connect with USB 3.0 speed regardless.

You can and it will improve transmission but can also make reception worse since it can also recieve more interference, though interference is primarly close sources. Personally I recommend just buying more known good Zigbee Router devices instead since that will do a better job at improving you network mesh which is most important.

Thank you for the fast feedback.

So you think I could leave it like that for now? So in my case, is the dongle far enough away from the USB 3 port to minimize interference?

You can and it will improve transmission but can also make reception worse since it can also recieve more interference, though interference is primarly close sources. Personally I recommend just buying more known good Zigbee Router devices instead since that will do a better job at improving you network mesh which is most important.

OK. So more and bigger (antenna) is not automatically better. Hmm? Maybe the routers mentioned. In the same coordinator’s room, it’s actually just an IKEA driver. In the next room and in the hallway next to the coordinator’s room (maybe 4-5 meters away) there are two HUE bulbs each and then in other rooms there are HUE bulbs and HUE ceiling lights. I thought I was already well stocked with routers. Maybe I should additionally install a router or range extender in the coordinator room?

The LQI of the IKEA driver in the same room about 2 meters away from the coordinator is just about 130. With the two HUE bulbs mentioned nearby it is only 60-80. And so on in the next rooms less and less.

As long as you already taken basic actions to avoid interference then adding enough ”known good” Zigbee Router devices is the key to success.

Also make sure that you never power off a Zigbee Router devices, which is why it is not recommend to Zigbee lightbulbs in lights if you have not removed the dumb switch.

Read this → Not many people know that... A random collection of Zigbee trivia

And this too → Zigbee buyer's guide

1 Like

Thank you very much for your feedback and the useful links. Now I still have a lot to read.

Thank you for this amazing write up! I’m new to home assistant and I’m currently awaiting my zigbee dongle to be delivered so anxiously I jump everytime I hear my phone chime or doorbell ring hoping for an update on it arrival! I will definitely be referring back to this :heart: AMAZING!!

I think this point is missing from your great post (or I missed it):

An underestimated source of errors are routers/repeaters that are connected to a physical switch. Typically this happens when someone (like me) replaces their non-smart bulbs with zigbee bulbs. When the light switch is on, everything works, the zigbee bulb can be controlled via the home assistant. When the light is turned off at the physical switch, the light goes out. But in the background the Zigbee network loses one (or even several) routers/repeaters.

The only option is to always power the zigbee bulbs (which act as routers/repeaters) and to replace the physical switches with zigbee switches.

Is it possible to configure the Zigbee network so that it does not use Zigbee bulbs as routers/repeaters? As far as I know, no.

From here the content no longer fits the topic, so I have created a new topic here.

Off topic stuff...

My goal is that I can turn the light on and off with a switch (zigbee or physical). When it’s on, it dims depending on activity and sun.

Now my special request:
I would like to be able to turn the lights on and off even when my home assistant rapberry pi is unplugged or not available.

I currently have this setup with wifi bulbs and physical switches. When the WiFi bulbs are turned on with the physical switch, they immediately light up as when they were turned off (or a preconfigured value).
As soon as the WiFi bulb is registered in the WiFi network, this triggers an automation that tells the WiFi bulb how it should light up. I think this is not possible with zigbee bulbs? At least not without disrupting the network by adding and removing routers/repeaters…

All hints and advice are welcome!