ZHA Vs Zigbee2Mqtt

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, but not sure about, 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.

1 Like