ZHA (Zigbee Home Automation)
ZHA is one of the integrations into Home Assistant that allows you to run a Zigbee mesh network for a smart home. It supports Zigbee 3.0, as well as previous older versions.
I assume you are already familiar with the basics of Zigbee and so you should start by choosing a coordinator suitable for ZHA.
Choosing a Coordinator - Recommended Hardware
ZHA uses the zigpy library, which makes ZHA theoretically compatible with all Zigbee coordinators (radios) that this library supports.
1. Coordinators Based on EmberZNet from Silicon Labs - EZSP
The best choice currently is coordinators based on the EFR32MG21 chip and using the EZSP protocol. The chip should allow and support the Thread protocol in the future. This chip is also used by the creators of Home Assistant for their products.
Home Assistant SkyConnect
USB adaptér pro připojení Zigbee / Thread zařízeních k chytré domácnosti od tvůrců Home Assistanta.Home Assistant Green
Centrální jednotka - sloužící k ovládání domácnosti přímo od tvůrců Home Assistanta.Sonoff Zigbee 3.0 USB Dongle Plus E
USB adaptér pro připojení Zigbee zařízeních k chytré domácnosti.Zigbee ZB-GW04 Adapter
I currently use SkyConnect from Home Assistant mainly because I wanted to be prepared for Thread support directly in Home Assistant as soon as possible.
2. Coordinators Based on deCONZ from Dresden Elektronik - DECONZ
Phoscon ConBee III
USB adaptér pro připojení Zigbee zařízeních k chytré domácnosti německé výroby 3. generace.Phoscon ConBee II
USB adaptér pro připojení Zigbee zařízeních k chytré domácnosti německé výroby 2. generace.Phoscon RaspBee II
I have both II generation products from deCONZ, but if you don't have a specific reason, I recommend ConBee III today, which you can place further from the Raspberry using a USB extension cable to reduce interference.
3. Coordinators from Texas Instruments - ZSTACK
The oldest chips, which I recommend only if you really want to save money. Firmware flashing is required, so they are not suitable for regular users.
- CC2652P/R/RB USB dongle with flashed Z-stack coordinator firmware
- CC1352P/R USB dongle with flashed Z-stack coordinator firmware
In the past, I used the CC2531, which is now outdated and its range was not the best. Currently, I do not use any product from this range.
Updating Firmware of EZSP Coordinators
This chapter only applies to EZSP coordinators. If you plan to or have another one, you can skip it and continue with the next Coordinator Installation.
The new version offers faster response and improved network stability.
EZSP Sonoff or ZB-GW04
-
Connect the adapter to the computer via USB.
-
Make sure no application or process is using this adapter on the computer.
-
Open a Chrome-based browser and go to darkxst.github.io/silabs-firmware-builder
-
Find your adapter - for EFR32MG21, you need to find out the version 1.1 or 1.2 - it is written directly on the adapter board.
-
Click Connect and after a while, a dialog with your version and the latest available should appear. Click Upgrade.
-
The new firmware starts installing - do not disconnect the adapter or turn off the computer!
-
Done!
EZSP Home Assistant ZBT-1 (SkyConnect)
I recommend updating via the Silicon Labs Flasher add-on.
-
Install the Silicon Labs Flasher add-on
-
Disable the ZHA integration or turn off Zigbee2MQTT depending on what you use.
-
In the add-on settings, select the adapter.
-
Start the add-on and check the logs to see if everything went well. The add-on will turn off automatically.
-
Re-enable ZHA or start Zigbee2MQTT.
-
Done!
Coordinator Installation
I will assume you have chosen one of the USB coordinators, and then the installation is quite simple. Just insert the USB coordinator into one of the USB ports.
In the case of Raspberry, I recommend using USB 2.0 ports (the black ones) and generally, it is better to connect the coordinator to the computer via a USB extension cable - both to reduce interference.
Vention USB 3.0 Male to Female Extension Cable 0.5m Black
Prodlužovací kabel USB 3.0Vention USB 2.0 Extension Cable 0.5m Black
Prodlužovací kabel USB 3.0Software Installation in Home Assistant
The installation is quite simple.
-
Insert the selected coordinator into the USB port (ideally on a USB extension cable).
-
In Home Assistant, choose Settings -> Devices & Services -> Add Integration and search for ZHA.
Or click on:
-
Select the port of your coordinator from the list.
-
Done! and you can start pairing new devices.
Pairing a New Device
-
Open the menu Settings -> Devices & Services and click on the Zigbee Home Automation item.
-
Select the Configure option.
infoIn the ZHA integration, in the same menu where we have Configure, there is also an Add Device item, which is not used for adding new Zigbee devices, but theoretically more coordinators - which ZHA does not allow.
-
In the bottom right corner, click Add Device.
-
Turn on and activate the pairing mode of the device you want to add.
-
Once the device is found, its setup will begin.
-
Once everything is set up, the device will turn green, and you will see a list of all entities.
Viewing the Zigbee Network Diagram
Once you have more Zigbee devices, it will become more difficult to keep track of them. Fortunately, ZHA offers a nice visualization diagram where we can see:
- Coordinator - rectangular shape
- Zigbee devices under permanent power - ovals
- Battery-powered Zigbee devices - circles
The diagram is especially useful if some Zigbee devices in the network are not working, and we need to find out why.
Between individual devices, lines of different colors are drawn, representing communication between these devices with the signal strength indicated - the maximum is 255.
Changing the Zigbee Channel
Properly setting the Zigbee network channel is key to minimizing interference from WiFi networks that operate on the same frequency band.
Channel overlap can lead to significant performance degradation of both networks and poor response of individual devices in the smart home. I recommend finding out which channel has the most WiFi networks and choosing the one that is least occupied.
WiFi channels are much wider, so we have only three in the 2.4GHz band, while Zigbee has 16. I recommend choosing channels at the interface of WiFi channels, i.e., Zigbee channels 11, 15, 20, or 25.
Mapping WiFi vs. Zigbee Channels
Setting in Home Assistant
-
Open the menu Settings -> Devices & Services and click on the Zigbee Home Automation item.
-
Select the Configure option.
-
In the Network Settings section, click the pencil icon next to the channel.
Configuration Backup
-
Open the menu Settings -> Devices & Services and click on the Zigbee Home Automation item.
-
Select the Configure option.
-
In the Network Settings section, click Download Backup.
-
Save the generated JSON file to a safe place.
This is a backup directly in ZHA. However, I prefer either backing up the entire HA add-on or backing up the entire VM if Home Assistant is running in it.
Comments