Improve network range and stability
In case you are experiencing an unstable or bad network range you can do the following things to improve your network.
Adapter
Use a recommended adapter, especially the CC2530 and CC2531 are known to perform poorly.
USB based adapter
The range of these adapters can greatly be improved when connecting them with an USB extension cable instead of directly plugging it into the computer (e.g. Raspberry Pi). When plugged directly into the computer, the antenna suffers from interference of radio signals and electrical components of the computer. Also be sure not to position the adapter too close to any other radio transmitting devices (e.g. a Wi-Fi router) or an SSD.
A USB extension cable of 50 cm is already enough to reduce the interference. Preferably get one with shielding as this may give better results (source).
Do not underestimate this! Placing your adapter close to an USB port can kill the radio signal entirely as demonstrated in this article.
Aditionally, it may help to plug the adapter to a USB 2 instead of USB 3 port.
Try different orientations of the adapter
RF connection between the adapter and other devices also depends on the way it is oriented in space. You might be having very poor linkquality
reports and intermittent ping failures but once the adapter is rotated a little it all can change greatly without re-locating the coordinator far away. Try to experiment with positioning and orienting the adapter in space while monitoring the linkquality
values reported. You might find it useful to buy a small rotating USB connector like this:
Reduce Wi-Fi interference by changing the Zigbee channel
Changing the Zigbee channel requires repairing of all your devices!
As Wi-Fi and Zigbee both operate on the same frequency space (2.4 GHz), they can interfere with each other. By using the correct Zigbee channel, interference with Wi-Fi can (partly) be avoided. A good article explaining this is Zigbee and Wi-Fi Coexistence.
To change the Zigbee channel Zigbee2MQTT uses you have to set the channel
in configuration.yaml
.
Interference from other 2.4 GHz devices
Any device using the open 2.4 GHz spectrum could interfere with Zigbee such as Bluetooth or gaming devices like Logitech “Unifying” or “Lightspeed” or Razer “Hyperspeed Wireless”.
Adding routers to your network
"Zigbee is a low-power wireless mesh network standard targeted at battery-powered devices" (see Wikipedia). Yet, low transmission power can be the cause of an unstable or unreliable network:
Zigbee2MQTT enables the user to increase the transmission power for some coordinator models. However, this simple measure might yield to a network with weird behavior, if messages to an end device reach their target, but responses (or messages) from that end device do not reliably reach the coordinator:
Introducing a router (read more about this) can improve the forward path as well as the return path:
You might choose a dedicated router (for example, a SONOFF ZBDongle-E based router) or a mains-powered Zigbee device (for example, a Hue lamp) to stabilize your network. Almost all AC powered devices will serve as a router.
Please note that there are routers of mediocre quality that might not harmonize well with your network (for example, some versions of the SONOFF Smart Plug S26R2ZB are known to be limited). This may yield in message routing errors. In case you have such devices in your network, it might help to add additional routers of better quality and bind your devices to these routers (re-pairing devices with “Permit join” restricted to the new/better router) to improve the overall network performance.
If you assume to have routing problems, try sending an MQTT request to the bridge to the topic zigbee2mqtt/bridge/request/networkmap
to retrieve a map of your Zigbee network including routes.
For more technical details on Zigbee routing, see the "5. Routing" in the TI Z-Stack User Guide, for example.
Hardware
Although Zigbee2MQTT does not require many resources, the hardware you are running Zigbee2MQTT on can impact the performance. This is especially true when using low-power hardware like the Raspbery Pi 3. Make sure that enough resources (CPU/memory) is free. For example, running Home Assistant + Zigbee2MQTT Home Assistant addon on the Raspberry Pi 3 may give bad performance.