Is there a comparison of the two? ZHA and Zigbee2Mqtt. Are they even alternative to each other ?
I would like to know when to choose one over the other. I’m currently using ZHA with no issues.
Is there a comparison of the two? ZHA and Zigbee2Mqtt. Are they even alternative to each other ?
I would like to know when to choose one over the other. I’m currently using ZHA with no issues.
Here’s some good info on them. I was just starting out and this pushed me to go with Z2M instead of the other 2 options.
If ZHA is good for you and your devices, there is no need to change.
If your struggling with device support, have a device that seems like too much work in ZHA, or need to separate your zigbee install from the HA install, look at z2m.
IMO, ZHA is easier to start, but z2m is easier to live with.
As the native HA zigbee integration, HA will detect your stick and walk through the ZHA setup, and the UI is all nicely integrated.
ZHA strives to be more standards compliant, meaning devices that follow zigbee standards should “just work” out of the box. Zigbee standards conformity is a worthy a goal, but is limited in practice. Too many device manufacturers pay little, if any, attention to the standards (Aqara, Tuya, others).
When following the standards works, it is great. I recently bought a newly released Sonoff S40Lite plug. Nothing was needed to have the plug work with a months old ZHA install.
Zigbee2Mqtt is more work to setup, but is easier to work with day to day due to what I consider wider and deeper device support.
Wider meaning z2m supports more devices and often supports new non-standards compliant devices more quickly. Deeper meaning z2m will often expose more device features as entities and attributes in HA. Largely due to the more established user/dev base.
Using my Hue motion sensor as an example, both z2m and ZHA give you occupancy, illuminance and temperature entities, but only z2m exposes the sensitivity and timeout configuration options as entities. In fairness, the settings are accessible in ZHA via service calls and/or the Manage Clusters menu, but you have to know to where to look, and then research or trial and error what values to use.
Another example is the Aqara Vibration sensor, everything is available in ZHA, but you have to figure out and parse various events by trial and error (but there are blueprints available). In z2m pretty much all options and data are available as entities or attributes easily accessible in the automation UI.
Paradoxically though, to my knowledge, ALL devices in z2m need a converter manually written for them. New devices are supported very quickly, but nothing “just works” in z2m until a converter has been written.
The Sonoff S40 Plug mentioned above was useless in z2m until I installed a converter for it. In this case it wasn’t difficult, just copy/edit the S31 plug definition, but it had to be done. Other devices might not be so straightforward.
There are options to manually installing the converter - I could have waited a couple weeks until the July z2m release, or switched to the dev branch, where it was supported within a couple days of availability.
Another advantage to z2m is what some may consider a disadvantage - it is not directly tied to HA. As a separate system, upgrades to z2m won’t directly impact/break HA and HA upgrades won’t break your zigbee network. The design can be beneficial if you need a separate zigbee net. Have a separate workshop in the backyard? Install a Pi with z2m in the workshop and have all those devices report back to your HA via mqtt over the LAN. You can have a separate z2m instance for the main home.
I’ve used both, started with ZHA because it was easiest to get running, but ultimately took the time to migrate everything to zigbee2mqtt. I started with z2m testing one “problem” device, and quickly moved most everything to z2m. Everything I had was supported as well or better in z2m, so it made sense to move everything to keep the mesh as strong as possible.
But I still keep ZHA installed alongside z2m. Sonoff dongles are inexpensive, so why not? I like the goals of ZHA, even if I’m currently using z2m. Things progress quickly and I like having the best of both available.
If your interested in, but not sure about changing, it’s probably worth $20 to grab another coordinator stick and experiment without bringing down your existing zigbee net. If you like z2m, migrate at your leisure, if you don’t, re-flash the dongle with router firmware and add to your mesh.
Hello
I am made my home assistant installation and like many person I may be trying the two solutions…
Is it possible to have a gateway (coordinator…) under ZHA and other gateway (second coordinator) under Zigbee2Mqtt ?
I have a gateway Sivercrest lidl hacked (non tuya cloud) under IP connection…connected to ZHA with zigbee material A B and C…
I am very happy of this…
I have dongle Usb Sonoff P. I want to add to Zigbee2Mqtt only…
So I use this with zigbee material D E and E…
Thanks
Yes. You can run ZHA and z2m side by side as long as they each have their own coordinator.
Thanks for your response
I will try this week
Hi,
@Titou43 or @jerrm. Very intesresting your post.
I want to do the same as you as i have somme issues with a few devices. I’m using ZHA with a Sonoff 3.0 Dongle +. Would you have the main steps to follow to install Z2M in parallel (I have a second Sonoff dongle and I guess that i have to play with the channel before pluging the dongle).
Thanks
For me, installing Zigbee2MQTT in parallel—after installing ZHA seemed no different than installing Z2M by itself.
Take some care around the serial port naming and your selection of coordinators. I wound up using the two ITead Sonoff ZBDonglesx—one E and one P. One is better supported by Z2M, from memory I think it is the non-V2, the TI CC based one. (The EFR/EZSP v2 support is still experimental in Z2M, but that is fully supported by ZHA.)
Those two devices get different “generic”mserial port names /dev/ttyUSBn vs /dev/ttyACMn. In the config I used the much longer by-id device paths that have the USB IDs in them so there won’t be any chance of getting those wrong when other USB serial devices are plugged in. (I”m not sure if there is a way to find those /dev/ entries under HaOS…)
I installed ZHA first and with only the coordinator for ZHA plugged in. Then I plugged in the 2nd coordinator and installed Z2M per the instructions.
Operationally, you need to make sure permit to join is turned off to avoid Z2M pairing with devices you intend to try with ZHA. Z2M out of the box will always be listening for pairing and is faster to respond.
If necessary you can blacklist Zigbee devices in Z2M that you intend to only use with ZHA.
Re: ZHA vs Zigbee2MQTT
This week I started my own parallel installation and comparison. I had put off using Zigbee for a long time because it seemed like some considerable learning was needed to make the right hardware, software, configuration, and network topology decisions in order to have a highly reliable installation. Three years ago I chose Zwave for all of my smart switches. They have all been working quite well and got a considerably better user experience with the addition and evolution of ZwaveJS and ZwaveJS2MQTT (now called the ZwaveJS UI in Home Assistant add-ons. I’ve been hoping that Zigbee2MQTT would get some of the niceties of ZwaveJS2MQTT.)
I just found this thread today. @jerrm’s write up is very good and matches what I’ve seen so far, particularly that Z2M device support seems to be more complete and robust.
A few things that I can add to this topic so far:
Given the support by the HA developers, my expectation was that ZHA would have a much better overall UX. For installation ZHA wins. However I find ZHA’s UX for pairing devices and troubleshooting pairing, and general Zigbee troubleshooting to be much worse than Z2M.
To some degree, the notion of there being a Zigbee network between HA and the Zigbee devices, seems to be either intentionally abstracted away or not fully fleshed out in the UI. It is also possible I’m just not sure where to look. Yes there is a minimal map.
I expected to have to do more fiddling with MQTT auto discovery, but so far none has been required.
Going forward, I expect the “dual stack” Zigbee and Matter/Thread implementation for SkyConnect will probably evolve much more quickly in ZHA and that’s where the HA/Nabu Casa people’s efforts will be.
I expect that I will probably leave all of my Zigbee devices that are in “production” (as in are used productively for home automation) on Z2M and keep that away from any dual stack experimentation/evolution for at least a year or maybe more.
Those are my thoughts, hope they might be helpful. Would be interested in other opinions.
How do you connect devices to both coordinators then? I thought it can be paired only with one at a time
You don’t. It is two separate networks.
You need two separate coordinators, and it’s a problem if you purchase two of the same model from Sonoff, that screws up these serial by ID setting. Ask me how I know.
You could buy a Sonoff P plus a Sonoff E, or a P and Conbee II, or an E and a Conbee II.
Install the Zigbee2MQTT add-on and while at it, install MQTT Explorer addon in case you have to troubleshoot MQTT. Install and configure the Mosquito MQTT broker add-on if not already installed.
Do some basic settings in the Z2M add-on, just from memory make sure you have the home assistant integration set and the device serial port set (find your serial by ID for the coordinator you want to use for Z2M). Of course also define your MQTT broker location and MQTT user information.
Turn auto discovery off in both ZHA and Z2M. Thats important. Purchase your new device which supports your intended protocol, then temporarily allow auto-discovery for that integration (ZHZ or Z2M), put the new device into pairing mode, add the device, then turn off auto discovery. That’s real important…ask me how I know.
If adding the device through Z2M, once it pairs and the interview is done and you want to rename the device to make it something logical for you, there’s a little tick box in the edit window which when selected, will make your life easier as it passes the naming change through to homeassistant. Don’t get me wrong, homeassistant will have the new device under devices since you will have already set up the home assistant integration tab as well, but why should I have to change the name twice.
Of course you may have to enable some of the desired entities for your new device but that is standard for any device on either protocol.
Works for me, I have a mix of ZHA and Z2M devices and I’m a rookie at this who knows very little.
I just switched from ZHA to z2mqtt because of the “deeper” support of devices, I was missing some features I can use now.
One thing I experienced is reaction time is a bit slower, for instance motion sensors reactions are slightly slower, is this a known “problem”
It’s a great read for me this thread and now I finally got the understanding why my ZHA is not reliable when / after I reboot HA.
I can have my zigbee network stable for weeks, if I don’t touch HA at all, so no HA updates or HACS so I need to restart HA if I do that too often the ZHA integration also restarts and my zigbee network becomes unreliable. Fix usually is just to unplug the adapter for an hour and have the mesh rebuild and it’s stable again.
I can now understand reading about Z2M (never tried it) that it runs as add-on and is not impacted by HA updates or playing around. Just wonder why is ZHA not added as an add-on as well to prevent these issues ? don’t think it would complicate the setup process that much to install an add-on, after all it is software that requires som tinkerering. But I just tested several times now, for me at least if I want stable ZHA I should not keep updating each week with either HACS or HA updates that comes through the month and then all is great.
I run skyconnect stick and overall works great, when I leave it be. So I guess I have to try Z2M if I want to be able to update & restart HA when I feel for it.