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.

Mesh

A wireless mesh 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 / routers.

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 should be located as far as possible from any 2.4Ghz interference, including WiFi cards, bluetooth stuff and electronics.

It's a good idea to plug your USB ZC dongle to an USB extension cable to keep it a few decimeters from the computer itself.

The official name is coordinator, but it's almost always referred as hub.

Repeater / Router device (ZR)

Usually a non-battery powered device is always alzo a ZR. This kind of device acts as a mesh router (but it's almost always called repeater), and your ZigBee network will need quite a few of them as the signal is very weak and even thin walls can shield it completely.

End device (ZED)

Usually a battery powered device that cannot act as a router / repeater. Beside this, there is no difference with ZR.

Planning

ZigBee is a low-power network mesh, so a little bit of planning is required 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, i will give you some pointers later on on this. 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)

First of all you must ensure that your ZigBee channel does not overlap/get disrupted by your WiFi (2.4Ghz) network, but this will be discussed shortly. The following will assume you have taken care of that.

The basic rules with ZigBee planning are:

  • Buy a good number of pure ZRs and place them properly scattered. I have one ZR for each floor of my house.
  • Place your other kind of ZRs (like smart plugs) so that they are not covered by the appliance they power. For example, the smart plug behind the fridge will not manage to get a good signal, due to the fridge itself.
  • Do not assume your smart switches will act as good ZRs. Since they are buried inside the wall and mixed with electric wires, they will not work reliably as routers
  • While a good suggestion can be only buy good brands, and good quality, i went the chapo chinese way and adding a few, cheap as well, dedicated routers solved all my problems and saved lots of money too.

So, to elaborate on the above, your ZigBee mesh will start acting up with no reason at all and spit out various errors in Home Assistant and your automations will start to fail at random? It's time to add some dedicated ZR 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.

With some more details, ensure you have at least one ZR in each room, and two ZR always are in line of sight, if possible. Ideally, add one dedicated ZR every crucial point in your home, and at very least one or two for every floor. Don't forget that the signal irradiates like a sphere, so the shortest best could be trough a floor or a wall.

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 one.

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.

So, pick two WiFi channels (ex 1 and 6, or 6 and 11, or 1 and 11) and choose your ZigBee channel do overlap with the channel you do not use.

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.

If possible, choose ZigBee channel 11(the first one) or 24 (channels 25 and 26 might not be supported by all devices).

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:

Last, but not least important, pay attention to the interference (EMI) from your Home Assistant itself to the ZC! You want to plug it with an USB extension cable and definitely trough an USB-2 and not an USB-3 port. If you only have USB-3 ports (like i do), get a cheap USB-2 hub (not powered should be good in my experience) and plug it between your USB-3 port and the ZC itself. To have the maximum flexibility, an USB to CAT-5 extension dongle could be used, this would let you move your ZC even tents of meters from the Home Assistant, and maybe in a better position overall.

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.

The issue is always only one: interference and 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. Not 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:

  • Red and gray links cannot be totally 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.
  • Ignore ZED, the fix is only at ZR level

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. By purchasing a dumb multi-plug and moving a smart-plug (a ZR device) 30cm to the side of the fridge i fixed three ZED reception and the smart plug itself, no need to a dedicated ZR there. I had another example where a thermovalve (a ZED) 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.

Where no other actions can be taken, for example if you only have in-wall smart switches and ZED in the area, a dedicated ZR 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 ZR devices for a stable mesh.

I have almost 100 ZigBee devices, three floors, and four dedicated ZigBee Router (ZR) 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. Turning on and off ZigBee devices might help, but don't go turning your main power on and off only to restart in-wall smart switches and such. This is a once a day patient work, which will pay out if you follow my suggestions.

This is actually the last note: online resources are wildly useless. The only true solution is detect your islands and ensure they are properly connected.

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.

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

Pairing

Each ZigBee device usually has a way to start pairing, you should refer to each device manual. Usually either you power it up, or you long-press a button to start pairing mode.

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

At this point, each new ZigBee device should popup and you can assign a name and a zone to it. I strongly recomend you start pairing one a time and not more than one device simoutaneously or things can get messy.

I had ZigBee devices requiring to be plugged-unplugged three times to start the pairing process, and in at least one case that was not even written in the small and useless manual it shipped with. Be aware of that.

Grouping

ZHA let's you group devices together, which can be nice to issue common commands and even reduce your ZigBee network load.

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