ZigBee2MQTT vs. ZHA: Commissioning and relocation

 

First Phoscon, then Zigbee2MQTT (Z2M) and most recently Zigbee Home Automation (ZHA): I have extensively tested all three ZigBee gateway software solutions with Home Assistant and am now using ZHA, which is also the primary topic of this article. Switching from one gateway solution to another can be a bit of a pain, depending on the number of connected devices. As an example, when I switched from Phoscon to ZigBee2MQTT, I had to reconnect all the devices, which is not really fun especially with the in-wall dimmers. The transition from Zigbee2MQTT to ZHA has been much easier, since the devices have largely reported themselves in ZHA. Zigbee2MQTT has worked for me for over a year without any problems, so the switch would not really be necessary. The reason for the switch was more curiosity and to be able to compare the different solutions.

What is ZHA?

ZHA (Zigbee Home Automation) is a Home Assistant integration for direct connection of Zigbee devices in Home Assistant. For communication ZHA uses an open source Python library zigpy, whichimplements a hardware independent Zigbee stack .All coordinators compatible with zigpy can be used with ZHA.

Switching from Zigbee2MQTT to ZHA: Step by Step

Backup

The first thing to do for the switch to Zigbee2MQTT was to create a backup. At this point I had to realize that the backup of the Conbee II -Stick does not contain a coordinator backup, see: www.zigbee2mqtt.io/guide/adapters/#notes. When backing up a Zigbee coordinator with a chip from Texas Instruments (CC2530/CC2531/CC2538/CC2652/CC1352) a file with the name: coordinator_backup.jsonis created inthe ZIP file. For the Conbee stick a backup can be created, but without the coordinator_backup.json file. The file can, or in my case could, be used for a restore in Home Assistant. To create the backup there is a button in Zigbee2MQTT under "Settings", "Tools": "download_z2m_backup":

Customize access to Zigbee coordinator

I run Home Assistant as a container in Docker. The docker-compose file contains all necessary containers for running Home Assistant and its required services, see: Home Assistant Docker Conbee 2: ZHA,Zigbee2MQTT,deCONZ.

Before switching to ZHA, I started these two containers for Zigbee2MQTT in addition to the actual Home Assistant container:

  • Mosquitto (MQTT broker) and
  • Zigbee2MQTT

The Zigbee2MQTT container mapped the Conbee stick into the container via "devices". After the communication with the ZigbeeCoordinator is taken over by Home Assistant with ZHA directly, the device can be removed from the conatiner zigbee2mqtt and added to the Home Assistant container:

=>

At first, I did not remove the two containers zigbee2mqtt and mosquitto yet, so that I can still check in Zigbee2MQTT how the devices in it are connected. Since my setup has certain other devices using MQTT for communication, I'll keep the MQTT broker for now anyway. I won't need Zigbee2MQTT in the future, so I will remove it from the configuration after moving the Zigbee devices. If you are using a new operating system at this point, you must adjust the permissions for accessing /dev/ttyACM0 in the OS: 

 sudo gpasswd -a $USER dialout

The changes can be enabled via the docker-compose command:

docker-compose up -d

Add integration

ZHA can be activated in the settings and with "Add integration": Zigbee Home Automation:

Mapping to the Home Assistant container will make the ConBee II stick report to this location:

Subsequently, the previously created backup could be imported. As already mentioned but not for the ConBee II:

Somewhat desperately I selected the menu item: "Keep radio settings":

And lo and behold, the devices are gradually showing up in Home Assistant: 

While not all devices reported back, I still didn't have to reset any of the in-wall actuators, which is already a significant win to my first switch from Phoscon to Zigbee2MQTT. Most of the Aquare temperature sensors showed up after pressing the connect button several times, but I still had to re-learn some.

Rename devices

Unfortunately, all devices got a new name in Home-Assistant, which still gave me some work. To be able to use all existing Lovelance cards without any adaption, I gave all devices their original names again. For this I had to delete the old MQTT device first:

The new connections now show up under Zigbee Home Automation:

The device itself can be renamed via "Edit Settings":

Unfortunately, the entities were not renamed with this action and had to be edited separately by me:

From the new names I also could not deduce which device it is, so I downloaded a diagnostic file in the MQTT integration. The file contains the original names and IDs of the devices, which allowed me to look them up.

The ID can be viewed under "Device Information" and Zigbee Info:

Diagnostic Info the original name and ID listed without ":".

How to add a new Zigbee device to Home Assistant?

New devices can be paired with Home Assistant via Settings / Add device / Add Zigbee device.

Pair devices directly

In order to control the Zigbee devices directly from a switch via radio, there is an option to bind them directly. For this purpose I first created a group:

Create group for the devices to be switched:

Switch: Manage Zigbee device:

And bind the previously created group:

Depending on which devices are in the group, direct binding did not always work for me. As an example, my Innr LED Stripe could only be paired by first adding a Hue bulb to the group, then binding the button and replacing the bulb with the LED Stripe.

Visualize

In Settings / Integration you can use Configure and Visualize to display the Zigbee network and its connections.

Network settings: Backup in Home Assistant

In Home Assistant a backup of the network settings can be created via ZHA Integration.

It would also be possible to transfer the settings to another coordinator.

Comparison Zigbee Home Automation and Zigbee2MQTT

What are the advantages of ZHA compared to Zigbee2MQTT?

  • The ZHA setup is leaner compared to Zigbee2MQTT. Due to the use of MQTT as network protocol, additional services are necessary for the communication when using Zigbee2MQTT. The data is not transferred directly, but from Zigbee2MQTT to an MQTT broker, which communicates the data to Home Assistant.

What are the advantages of Zigbee2MQTT compared to ZHA ?

  • MQTT is an open network protocol and can be used outside of Home Assistant.
  • After ZigBee2MQTT can be run in its own Docker container, the connection to the devices continues even if Home Assistant is restarted.

Which Zigbee gateway software supports more devices: Zigbee2MQTT or ZHA?

  • Zigbee2MQTT lists a number of officially supported devices: 3444 von 409 Manufacturers, see: www.zigbee2mqtt.io/supported-devices/. There is no official statement for ZHA, yet it can be assumed that the number should be similar. Functions away from the Zigbee standard are provided in ZHA via corresponding adaptations (Quirks), see: https://github.com/zigpy/zha-device-handlers. Zigbee devices that adhere to the official standard work without an adaptation (Quirks). For this reason, more devices are supported than listed in the project. The concept of custom Quirks implementations is similar to the concept of Zigbee-Herdsman implementations as used by Zigbee2MQTT.

Conclusion

Those who want to integrate their ZigBee devices into Home Assistant will find a simple and solid solution with ZHA. The alternative Zigbee2MQTT, on the other hand, is based on an open network protocol, which requires a somewhat more complex setup. Although both systems work wonderfully, I would recommend ZHA - especially for a new installation.

 

 

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Updated: 2024-02-08 von Bernhard | Übersetzung Deutsch |🔔 | Comments:0

ZigBee

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details