ZHA vs Zigbee2MQTT - Pros 'n Cons for conversion

Converting similar tools

I recently converted from the native Z-Wave JS to Z-Wave JS UI. Both run on Z-Wave JS, so the conversion is just copying a few files and copy-pasting your keys.

Converting to Zigbee2MQTT

Converting between ZHA (built-in Zigbee Home Assistant) and Zigbee2MQTT is a lot more involved, and neither solution is going to 100% solve every issue.

From what I understand, Zigbee2MQTT → ZHA is simple. Just copy the network and import in ZHA.

On the other hand, going from ZHA → Zigbee2MQTT is the problem and why I created this thread.

A common situation

It’s more common that you’ll use the default ZHA integration in Home Assistant without a second thought because stuff just works, and then you’ll see all these guys with killer Zigbee setups and wonder “how can I have that too?”.

I’m in this situation myself. I have over 90 Zigbee devices, and more are coming. I also have hundreds of Wi-Fi devices too and as hard as it’s gonna be to recreate my Zigbee network, it’s just as hard to change the Wi-Fi password on tons of “smart” (inconvenient) devices.

Comparisons

ZHA

ZHA has a lot going for it

  1. Supports standards-compliant Zigbee devices outta the box. Don’t even need to wait for someone to create an integration in some cases.
  2. It comes with Home Assistant and is a 1st-class citizen in the ecosystem showing a fancy Zigbee logo for each device.

On the other hand…

  1. All the cool kids are on Zigbee2MQTT.
  2. Device support is supposedly worse than Zigbee2MQTT, but that hasn’t been an issue for me, and probably won’t be for folks buying newer Zigbee 3.0 devices.
  3. It’s cool that the network mesh view exists, but it’s sub-par compared to both Z-Wave JS UI and Zigbee2MQTT.
  4. Because the tooling is less troubleshooting-friendly, you also have a harder time finding and fixing issues.
    1. Troubleshooting tools are a must for any technology you own especially when you have hundreds of them scattered around your home.
    2. We’re all our own IT guys, so we need IT-guy-level tooling.

Zigbee2MQTT

Zigbee2MQTT has drawbacks

  1. It’s not easy to install.
  2. If you wanna convert from ZHA, it requires completely recreating your entire Zigbee network. This is where most people like me stop. Redoing 90+ devices and making sure all automations and dashboards still work? No way.
  3. Zigbee2MQTT isn’t a first-class citizen. All devices show up as MQTT rather than Zigbee with that nice red logo.
    1. It’s not even guaranteed all MQTT devices are Zigbee. I have one in particular (my bed) that also uses MQTT.
    2. Surprisingly, Z-Wave JS UI also uses MQTT, but it doesn’t have this issue because it doesn’t use the Home Assistant MQTT. This is why it can be treated like a first-class citizen and work with the existing Z-Wave stack.
  4. It’s very complicated to setup. You have to install this stuff, and it’s not straightforward. You have to want to tinker to use this tool, yet the tool is pretty important if you want to have an extensive Zigbee network :confused:.

Why use Zigbee2MQTT?

Then why would I wanna use Zigbee2MQTT?

  1. All the cool kids use it. I dunno how much I have to stress this. It means that if you want support or if you wanna watch a YouTube video on Zigbee, they’re probably running Zigbee2MQTT, so you should probably do that as well.
  2. Zigbee2MQTT supports just about every Zigbee device. This is where the “community” is in terms of device support. Great network view, great device view with pictures, great Z2M dashboard just for Zigbee devices, etc. It’s separate from Home Assistant, but that’s partly what makes it so powerful!
  3. You can have multiple controllers in your network as part of a single mesh. This is still confusing to me but unlike ZHA, you can have multiple Zigbee controllers around your house, even PoE ones, and those can all act like a single Zigbee network just like adding Wi-Fi access points!

Conclusion

It’s not exactly clear which way you should go especially if you already built out a Zigbee network with hundreds of devices. You could have both, but let’s be honest, we only really want to manage one solution.

If there was an easier way of converting from ZHA to Z2M, I’d say go for it. Probably worth the time investment. Since you have to redo the whole thing from scratch, you will run into issues for months after, and it will take time to figure out and fix everything.

1 Like

As with recent z2m versions.

Never been an issue for me.

Pretty sure HA speaks via websocket, not mqtt for zwjs.

More complicated, yes. Not sure I’d say “very.” Several good step by step tutorials out there.

No. Only one coordinator per zigbee net/z2m instance, but you can run multiple instances of z2m.

It is worth the trouble to get a second coordinator and compare z2m side by side with zha.

If you end up preferring z2m, migrate at your leisure, it doesn’t have to be an all or nothing monolithic chore.

If you prefer zha, either leave z2m up for test or reflash the coordinator as a router for your zha net.

2 Likes

I say this as someone who hasn’t used Z2M, that said, my experience is that people switch to Z2M for one of four reasons.

  1. They want to use a Tuya device that doesn’t have a quirk built for ZHA. Z2M has a larger community of power users which results in faster support for Tuya devices.
  2. They want to decouple Zigbee from Home Assistant. This is in work with the ZHA websocket server, but not in place yet.
  3. They want to create automations outside of Home Assistant, usually with Node Red.
  4. They have mesh issues and instead of troubleshooting them, they move to Z2M and then end up resolving them as part of the move.

If 2 and 3 apply to your use case, then Z2M is probably the right way to go. If you are buying random Tuya devices that aren’t currently supported, add support to ZHA, most devices are pretty easy to add support for. Easier than moving to Z2M IMO.

If you have mesh issues, fix those.

2 Likes

Is it possible to run both ZHA and Z2M with two separate sticks? Say ZBT-01 and Sonoff ZBDongle-E or Conbee II.

Sure, but you will be creating two meshes. You need to ask yourself what problem you are trying to solve with a setup like that.

1 Like

With two separate sticks yes.

Just remember that means you are creating two separate zigbee networks that DO NOT talk to each other except through HA and each requires it’s own zigbee channel - which may be a consideration in high interference RF conditions (lots of Bluetooth, Wi-Fi etc.)

1 Like

Best advice ever.

I thought that was my solution but it seemed to create another problem and the first one isn’t solved either.

@PrairieSnpr: Unsupported switch. Ordered a stick which should solve but I’m stuck. I made a thread cause I need help to find a solution.

Right, like I said, changing to Z2M in an attempt to find support for a what I’m guessing is a Tuya device, is a ton of work for no real benefit. Either purchase a device that is already supported or find the Tuya data points for you device, create a quirk for ZHA and be done with it. If you need help with the later and are willing to do the work, post a new thread with your device details.

1 Like

Aqara Double Rocker WRS-R02. More here: Error starting Z2M. I may tried the impossible. Advice needed

I got so fed up I reset the Conbee II and will pair everything again with ZHA.

OK, not Tuya, still that thread doesn’t help fix your real issue. If you want it to work with ZHA, you need to provide details. Where is the device signature for the old switch and the new switch? Which quirk was in use for the old switch? Very likely there is a slight change to the signature or model number and just updating the previous quirk would solve your issue.

If you just want to move to Z2M, by all means carry on and good luck.

1 Like

Think of it like a boss in Elden Ring. You might fail a hundred times, but you only need to get it right just once in order to progress

1 Like

100% disagree. It is very easy to install one addon and have all the freedom. Buying the USB-Zigbee stick isn’t rocket science either.

Z2M also typically exposes more functionality than ZHA. And since it is on MQTT, you can use any other device you want and connect to that MQTT and read messages.

That’s the whole point of Z2M. It translates complicated Zigbee devices into MQTT-like integration extension supported by Home Assistant.

Whole bunch of inaccuracies on my part

Good to know!

Whoops, you’re right. I remember reading Z-Wave JS used MQTT, but not the Home Assistant one, but I remember seeing the WebSocket stuff! That person probably didn’t understand how it worked, or it changed in the last 4-5 years since Z-Wave JS became part of Home Assistant.

I did more research on Z2M. It seems like it’s gotten easier. You only need 2 add-ons, and you’re good right?

I forgot something

One thing I forgot to note is that Z2M has better support for Philips Hue. Not only that, they have firmware updates. ZHA doesn’t have Philips Hue firmware without having to update the Home Assistant YAML configs, and even then, it’s not natively supported; it’s some random dude making it possible.

Does that even matter in the comparison I wrote above? It matters to me, but I dunno how much it matters to other folks. If I remember correctly, ZHA overall has less support for Hue devices, but all of mine have worked so far.

Testing out Z2M

One thing I forgot about is the possibility of having multiple Zigbee networks.

If I remember correctly, ZHA only supports 1 Zigbee network. So if I wanted to have another, I’d have to use Z2M anyway, so it make more sense to have everything on Z2M, so I don’t end up with 2 implementations of Zigbee.

Seems dumb to have multiple controllers though because a more congested mesh is better, but it all comes down to the link speed of any device to the controller. It’s specifically an issue with firmware updates which can take hours. The more controllers you have, the faster you can update devices, but you have to split them up evenly to get the biggest benefit.

The bigger question is how to manage a 2-controller Zigbee network. Seems like it would work better if you had hundreds of Zigbee devices rather than ~100 like me.

Dual Zigbee Network Questions

I have 3 SkyConnects, so I could totally try what you’re saying, but I don’t wanna spend time messing with Zigbee devices if I don’t have to. I was expecting one of those two extra sticks to be used for Thread, but I never used or bought any Thread devices. I have a 3rd stick for who knows what. It’s an extra for this very purpose, switching the Zigbee network or moving it to another location if I so choose.

Any good resources on how to design a dual-controller Zigbee network if I wanted to try? I’ve had zero issues linking up all my devices even when I only had a few routers. Now that I have a bunch more, it’s less likely my Zigbee network will suffer unless I’m doing firmware updates. Those take up so much bandwidth and literally hours to finish!

Meshing issues

I don’t have meshing issues, but I’m curious how someone would go about fixing that with ZHA and why Z2M fixes it. Isn’t it just device placement? Or is Z2M better at letting you troubleshoot and figure stuff out?

Reason to go to Z2M from ZHA

What a fantastic post! I had no clue really why people used Z2M. I have no Tuya devices and don’t plan on buying any fly-by-night Chinese products either, so it sounds like I’d be fine with ZHA for that reason.

I’m interested in Home Assistant adding WebSocket support to ZHA. Wouldn’t that mean the Z2M interface could be put on top of ZHA?

Z2M > ZHA entities?

I’ve heard this from many YouTubers, but how? Which functionality is better with Z2M over ZHA? Why aren’t those things supported with ZHA? Or are they now?

To me, this is a big gray-area question that isn’t concrete enough for me to switch over to Z2M.

Reasons to switch to Z2M are simple: some (a lot of) device(s) don’t work in ZHA, but they work in Z2M – you either trash the devices or make the switch.

Most likely Tuya – they’re called garbage, but they are cheap.

Plus, in my case, I used to have “strange” issues with ZHA – like devices “disconnecting” all at once multiple times a day – nobody was able to help me with debugging what’s going on, but everybody loved to put the blame on me anyway ;-p I was fighting ZHA for a few months every day – since switching to Z2M, no issues, instantly, for the last… almost 2 years. “It just works” ™.

You have control over more device features typically. More entities are exposed. It is often more “advanced developer” mode in number of features.

Also, to comment Hue. Z2M (don’t know for ZHA to be clear) supports grouping of the Hue lamps, meaning you create a group (let’s say living room) and you put all your living room lamps inside and then you control the group to turn on/off these lights. Instead of sending one command per light, Z2M is able to send single command to all at a time (to a group).

Z2M is also capable to update Hue lamps, Hue sensors, Hue switches. It also updates my TRVs.

Please note that you don’t need to be convinced to switch. If ZHA works well for you, stick to it.

Concretely for Hue, I moved away from the official app, simply because their bridge supports max 1 command per second, so I wasn’t able to implement a Hue Tap to be controlled by HA, because if user rotated the wheel, it took ages to change the light state.

Avoid if at all possible.

Zigbee devices are more susceptible to RF interference and they live in an already congested RF range.

Every zigbee network needs its own coordinator and channel… and you should already be working through making it a non overlapping channel with ambient wifi. So you’d have to do that twice and the very existence of the second or third network both makes the other network relatively weaker than if those devices are in the first mesh (more nodes == better on most cases) and actively could interfere with it in extreme cases. So instead of making it better it could even make it worse.

So why do people do it? They don’t understand how it works and do it anyway. :sunglasses:

1 Like

A couple points here. Z2M isn’t fixing any mesh issues, they are both perfectly capable options. What happens is that when people move to Z2M, in the process of moving, they change other things that solve their original problem. Hedda has an extensive guide on how to solve mesh issues, most people would be better served following it. It’s especially frustrating when a new user clearly has mesh issues and they are advised to move to Z2M, which only results in further frustration.

As far as Z2M having more advanced functionality, that’s not really true in most situations. It is true that Z2M exposes more entities, but that doesn’t equate to more functionality. Admittedly, until recently, adding an entity when building out a ZHA quirk would often require an additional PR to the core Home Assistant repo which acted as a barrier. But even so, it’s really a difference in philosophies. The average user will look at a device in Z2M and see a ton of entities and think that it’s exposing more functionality, where that functionality is available, you just need to access it via a cluster command under manage zigbee devices.

With the new V2 quirks, we can expose entities from the quirk directly, but even so, you likely won’t see the same number of entities going forward. That’s just the design that ZHA and HA follow, where extra entities, even if they are disabled by default are frowned upon.

2 Likes

I’m interested in Home Assistant adding WebSocket support to ZHA. Wouldn’t that mean the Z2M interface could be put on top of ZHA?

No, this just makes it so you can run ZHA decoupled from HA. This allows ZHA to run on another device or just allows you to restart HA without restarting ZHA. If you restart ZHA 30 odd times when you are developing something, it’s almost guaranteed that some battery device will miss a check in and drop off the network.

1 Like

More entities with Z2M?

Which ones? What’s specifically different with examples?

This is what I’m saying. I hear that more entities are exposed, but I don’t know what they are or if I care.

This is what I was looking for. I found that command menu, and I used it last night with my Inovelli ceiling fan canopy module. Something was messed up where I couldn’t see all the advanced functions listed on the website (which show up for their wall switch):

Then I found out their website has all the advanced parameters listed and the values I could use:

The question is why I had to do this in the first place. Inovelli’s website states ZHA supports their Advanced Features, but for some reason, they’re not showing up. Would Z2M show these features or is it something broken in the Inovelli ZHA controls where these many advanced parameters are missing?

Groups/binding/light-link

Yep, ZHA supports groups/binding/light-link (I assume these are all the same thing). I don’t use them because they’re completely separate from Home Assistant groups, and I don’t like having the same thing defined in multiple places.

I’d love to use these groups, but I wish Home Assistant natively supported them. I’ve never had issues sending commands to lights with zero binding groups, so no big deal. I say “never had issues”, but I might be used to jank and not noticing it’s janky.

Firmware updates

No clue what TRV is, but Philips Hue can update with ZHA as well!

Not sure of a better way to do this, but you can add this config to your configuration.yaml (and restart HA) to get Philips Hue firmware updates:

zha:
  zigpy_config:
    ota:
      z2m_remote_index: https://raw.githubusercontent.com/Koenkk/zigbee-OTA/master/index.json

Firmware updates also exist for other manufacturers out-of-the-box.

Hue official app vs Home Assistant

I never used the Hue app myself. I’ve only ever paired my devices to Home Assistant. My first Zigbee was the ZBT-1 (SkyConnect) which I used on some IKEA devices. Then I bought some Hue motion sensors and lights, and it all just worked. Other than re-pairing, which sounds like it’d be a pain in the butt, it was straightforward.

2+ Zigbee Controllers

Great tip! I don’t want more than one Zigbee network :stuck_out_tongue:. But what about firmware updates? With lots of devices, they take forever because they often have to go through multiple hops, and the transfer speeds are super slow!

I’m not sure how large these firmwares are, but I can only do a few a night for the 30 that needed updating. There’s no rolling auto-update with Home Assistant where it can pipeline updating only 2 at a time.

ZHA drop-offs

That explains a lot of why maybe Z2M has this happen less, because it’s disconnected from Home Assistant unless you restart the whole Raspberry Pi or Docker container.

1 Like