User Tools

ZigBee

ZigBee (Wikipedia) is an IEEE 802.15.4-based specification for a suite of high-level communication protocols used to create personal area networks with small, low-power digital radios, such as for home automation, medical device data collection, and other low-power low-bandwidth needs, designed for small scale projects which need wireless connection. Hence, Zigbee is a low-power, low-data-rate, and close proximity (i.e., personal area) wireless ad hoc network.

In other words, ZigBee is a wireless protocol, low power, low consumption and highly reliable which proves very efficient for our needs. It's cheap, which means that ZigBee devices aren't expensive. It's low-power, wihich means you can have battery powered devices using it, and it's very widely used, which means you can find lots of devices using ZigBee.

External resources

ZigBee is not an easy protocol to manage, and it's has it's quirks. Here is a nice collection of very good resources on ZigBee that i suggest you read trough carefully:

Before stepping into ZigBee and dropping money in purchasing devices, i suggest you read trough all of this page and the above links.

ZigBee Glossary

Don't skip! This section is important to understand what is ZigBee and how it works.

Mesh

ZigBee is a wireless mesh, which is an approach where the wireless signal is extended by devices that pick up the signal on one side, and creates additional signal on the other side. Excuse my poor explanation, but i hope it's easy to understand.

On a wireless mesh, a much wider range is achieved by extending the original signal by devices at the edge of the original propagation area. This is not good for bandwitdh, because the same bandwidth get shared along the entire area covered by the mesh, but allows weak signals to cover extended areas without requiring any wired calbing.

ZigBee creates a wireless mesh using repeaters (also called routers) and is heavily dependent on a good and solid mesh. Each ZigBee device has a few meters range, to keep low power usage, and for this reason the number one requisite of ZigBee is to have a good mesh, and this can be achieved by purchasing dedicated repeater devices in addition to non-dedicated repeaters.

ZigBee signal is so weak that it usually do not pass trough walls, specially drywalls or stone walls (due to the metal inside). Even worse trough ceiling/floor since metal rebar is often present. This is why a strong mesh is critical to spread your ZigBee connectivity more than a few meters. Literally.

Hub / Coordinator (ZC)

It's the starting point of your ZigBee network. It can be a USB dongle connected to your Home Assistant or something more complex like a ZigBee to WiFi proprietary hub. It must be located as far as possible from any 2.4Ghz interference, including WiFi cards, bluetooth stuff and electronics. Even a gas boiler can create ZigBee interference when it's on. Keep your coordinator far away from anything electric when possible.

ZigBee-to-WiFi hubs (standalone) hubs are not really recomended if you plan to use Home Assistant, go with USB Coordinators. Keep in mind that you must plug your USB coordinator dongle to an USB extension cable (even better an RJ45 USB externder adapter!) to keep it a few decimeters from the computer itself, this because USB ports do generate EMC interferences that will propagate to the coordinator itself. Avoid USB 3.0 ports, use only USB 2.0 ports. If you have only USB 3.0 ports, absolutely use an USB 2.0 HUB and connect your extension cable to it rather than to the USB 3.0 port. Yes, this is very important.

Repeater / Router device (ZR)

As already stated, a working ZigBee network requires a lot of repeaters. This is the one and most critical point in running a working ZigBee infrastructure. Usually any AC powered device that uses both phase and neuter wires (and it's not powered by battery) is also a repeater.

Keep in mind that most cheapo AC powered chinese ZigBee devices will not work reliable as repeaters. In general, adding one dedicated repeater device in each room of your house is a good way to ensure a reliable ZigBee network over time. One single bad repeater can, and will, create hard to diagnose issues spreading trough your ZigBee devices.

By dedicated i mean that they are only routers, not smart plugs, smart bulbs, smart switches at all, they only have one function: to be a router. They usually are small USB devices that you plug into your wall plugs with a USB charger (⇐1A is plenty enough). You need them, even if your home is small, and that is the only reliable solution to ALL ZigBee issues acting up.

End device (ZED)

Usually a battery powered device that cannot act as a router / repeater. Beside this, there is no difference with any other ZigBee devices. Usually, these are sensors like door, temperature and so on. Also, TRVs (thermovalves) are usually end-devices.

Planning

ZigBee is a low-power network mesh, so a little bit of planning is madatory unless your entire house is an open space without walls or furniture, no wiring in the walls and no metal whatsoever (or rocks) either…

You ZigBee network, again, will not be easy to debug when messages starts to get lost. Better plan properly from the start!

From my personal experience ZigBee signal will:

  • not cross walls (unless, maybe, pure betongas walls)
  • not cross floors (unless pure wooden floors)
  • not cross stone walls
  • be shielded by metal rebars (including drywalls structures and concrete with rebars)
  • be distorted by running current or magnetic fields (including your electrical wirings, a boiler starting up, a dryer/washer starting specific power cycles…)

The mesh concept will work around all those issues pretty well, provided that your mesh is solid and well-connected. ZigBee is not WiFi, it's mesh. Totally different concept.

Channel selection

ZigBee has the concept of channels, like WiFi. While you can change the channel later on, it's not guaranteed that all the associated devices will. For this reason, you sohuld choose a good channel from the beginning and stick to that before you add any device.

In short: use ZigBee channel 11 which is the best bet to avoid WiFi 2.4Ghz interference. Channels 25&26 are also a valid choice, but not all ZigBee devices support channels above 24, so channel 11 is preferable.

Basic assumptions

The basic rules with ZigBee planning that i recomend you follow are:

  • Buy a good number of repeaters and place them properly scattered. I have one ZR for each couple of rooms on each floor of my house. I mean dedicated repeaters.
  • Do not assume your AC powered devices will act as good repeaters. Switches might be buried inside the wall and mixed with electric wires, while smart plugs might be covered by the appliance they power, so they might not work reliably as routers.
  • While a good suggestion can be only buy good brands, and good quality, i went the cheapo chinese way and adding a few, cheap as well, dedicated repeaters solved all my problems and saved lots of money too.

Again, creating a solid mesh with good repeaters is critical for a reliable ZigBee network.

Interference

ZigBee is a very delicate protocol, which unfortunately shares the same 2.4Ghz spectrum as WiFi 2.4Ghz and will be heavily disturbed by it. This page explains pretty well how to setup your WiFi and your ZigBee to avoid interference.

The basic idea is to choose WiFi channels that do not overlap your ZigBee channel. Since changing a ZigBee channel after it's been in use is complicated and will need repair for a few devices each time, i suggest to plan it in advance or move your WiFi channels and not your ZigBee network.

There are three non overlapping WiFi 2.4Ghz channels: 1, 6 and 11. These are the only ones that can be used totally free of respective interference. All ZigBee channels (11-26, which are not the same as the WiFi ones, despite having similar numbers) do overlap with at least one WiFi channel, and often with more than one.

In other words:

  • if you can choose your ZigBee channel, go with ZigBee channel 11 (or 25/26 if your devices support them).
  • If your ZigBee network is already up and running, pick one of the WiFi channels (1, 6, or 11) that are further away from your ZigBee channel.

Please take into consideration your neighbors as well, as they might have an overlapping WiFi. There is no golden solution, i am afraid, try to play around.

See the following overlapping map. Blue is the WiFi channel 1, green is the WiFi channel 6 and yellow is the WiFi channel 11, the smaller ones are all the ZigBee channels:

Debugging

It's not easy. All you will see are errors in your Home Assistant logs stating that something failed with some obscure error code (es 3074) and some internet searches would yield tons of useless pages of people with the same issue and no real solution.

But don't worry: the issues are always the following two:

  • EMC Interference
  • Poor mesh quality

What i told you so far should let you fix the issues, all of them, if you go back and recheck everything. But sometimes, debugging the issue is the only real way to find out where is better to act to fix it.

Open Home Assistant and go to the ZHA integration configuration page, open the graphical view of your mesh:i suggest you disable the two checkboxes as both auto zoom and physics will get in the way for the following. Now, try to unravel the mesh by moving the boxes around trying to put better links (green and yellow) together. You want to understand how the mesh is configured. You will see that it creates islands of devices with better links, and those islands are separated by weaker links (red). You want to act to change those weaker links into stronger links. Doing so, please keep in mind that:

  • Gray links cannot be avoided, it's perfectly normal to have lots of them. Don't worry.
  • You only want to connect the islands, nothing more. Don't overdo it.
  • It's a mesh: it will take care of itself, but you must provide opportunities for good links to become available, and this is on you.
  • Green means perfect. Yellow means more than good enough. Red means shitty and gray means i know you exist, i don't care at this time.
  • Getting a better coordinator is also probably a good idea, but getting more reliable repeaters is 99% the solution.

So, go ahead and link the islands, which means provide better links between the ZigBee devices in strategic places. Think wide, as that might imply to move some stuff around.

A few examples from my experience:

  • By purchasing a dumb multi-plug and moving a smart-plug 30cm to the side of the fridge i fixed three end-devices reception and the smart plug itself.
  • A thermovalve end-device always linked to a smart-switch on the other side of the wall (with a red link) instead of linking to a better signal smart-plug two meters away in the same room. I fixed that by moving the smart-plug closer to the thermovalve and the mesh picked it up instead of the other behind the wall.
  • Adding two repeaters on the stairwell of my house ensured a few rooms “islands” got a better reception and avoided a less reliable link that acted up when the drier was in function.

Where no other actions can be taken, for example if you only have in-wall smart switches and ZED in the area, a dedicated repeater device will works wonders. This is also the only viable solution to link islands between floors or far away rooms. I cannot stress enough that you need dedicated router devices for a stable mesh.

I have almost 100 ZigBee devices, three floors, and five dedicated ZigBee repeaters devices in my home.

Last important note: be patient. It takes hours for the mesh to re-calibrate, and you have no way to speed that up. You have no way to force devices to specific links, they will always auto configure.

Home Assistant

Home Assistant provides at least two different implementations for ZigBee. The main one, which i am using, is called ZHA, or ZigBee Home Automation. This is native in Home Assistant and overall preferred to the ZigBee2MQTT solution. This last one only advantage might be to de-couple your ZigBee stuff from Home Assistant itself, if you prefer.

ZHA needs to install it from the add-ons page in your Home Assistant installation, then you can start activating your ZigBee devices and pair them, one at a time.

Coordinator Hardware selection

At first i bought a cheap chinese coordinator, which worked fine up to 30 or 40 devices. Then i moved to a nice Sonoff coordinator with an external antenna and a Texas Instrument chipset, which gave me only issues and not a good overall coverage. At last i choose to move to a Home Assistant Green appliance and purchased the associated recomended Home Assistant Connect ZBT-1 device.

So far, the ZBT-1 has proven to be the best coordinator i have tried. YMMV.

Naming Convention

I name my ZigBee devices in Home Assistant with the following scheme: “[TYPE][FLOOR][ROOM].[number] - [[name]”:

  • TYPE: two letters code to identify the type of device (like LT for lights, SW for switches, TM for temperature sensors, and so on)
  • FLOOR: 0, garden. 1 ground floor. 2 first floor, 3 roof…
  • ROOM: 1 to X, where 1 is the leftmost room and N the rightmost room of the floor
  • number: when more than one type of device is in the room, identify each one.
  • name: human readable name like “main light of bedroom”.

With this approach, it's easy to remeber where the devices are located for future maintenance. I also write with a good marker on the device itself, or on a label attached to it, so that when more than one device is closeby located, like mulitple smart-plugs or swiched, it's easy to identify them.

Pairing / Reset

Each ZigBee device usually has a way to start pairing, you should refer to each device manual. In my experience the folling solutions will work:

  • Simple powerup the device once
  • Press a button/pinhole (if present) for >= 5 seconds
  • Press a button/pinhole (if present) three times
  • Plug/unplug the device three times quickly (specially if no button/pinhole is available on the device)
  • Set the device to a specific setting (ex: “off”) and press a button three times or long-press it for 3/5 seconds

When pairing mode is active, head to Home Assistant ZHA device page (under settings) and tap the add device floating button in the corner.

Start pairing one a time and not more than one device simoutaneously or things can get messy. Also, pair your dedicated repeaters first, AC powered devices second, and end-devices last.

Occasionally you might have to reset the odd cheapo device, specially after a blackout, in order to get it working again.

Grouping

ZHA let's you group devices together, which can be nice to issue common commands and even reduce your ZigBee network load. Note that not all devices support native ZigBee grouping.

Graphical view

ZHA provides a nice graph view to visualize your ZigBee Mesh network. From this view, you can appreciate how your ZRs are partecipating in the mesh and you can use it to understand where and how to add ZRs or move devices around for a more logical mesh distribution.

Usage

After the device is paired, it will appear as a new Home Assistant device and it will expose one or more entities that you can start using immediately. Each devie type and brand will expose different entities and behaviours. Most of them, if battery powered, will also report the battery level, which is very handy to replace them before they dies.

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information