General question: ZHA or Zigbee2MQTT and why?


I got a general question.

Using a CC1352P-2 as coordinator and ZHA right now.

Also some ZigBee stuff, mainly IKA lamps and switches.

Now I saw that in zigbee2mqtt the IKEA switches are showing a real switches and not only as battery like in ZHA where you need to check for events to automate.

What are the pros and cons for using ZHA or zigbee2mqtt?

If I want to switch from ZHA to the other, what do i need to do? All repairing? Changing automations/scenes/scripts?

Stuff is running in docker (homematic-ip, homeassistant, esphome) so no problems to get zigbee2mqtt and an mqtt broker online.

Thanks for all your answers.


1 Like

ZHA and zigbee2mqtt work in different ways. zigbee2mqtt must have support for the exact device you want to use, whereas with ZHA if the device follows the Zigbee HA standard it does not need explicit support. With zigbee2mqtt this means that if your particular device is not supported you may need to add the support to zigbee2mqtt, which isn’t hard. But with ZHA if your type of device or a custom feature is not supported it’s a much bigger problem.

Because zigbee2mqtt knows your exact device, the implementation is usually much better. With ZHA it’s generic and some things are not ideal.

zigbee2mqtt uses MQTT which separates the Zigbee processing from Home Assistant. This is a bit harder to set up but in the long run is more robust.

I have used both and now use zigbee2mqtt. Maybe you can think that ZHA is best for simple things and zigbee2mqtt is for the “power user”. Also I think the developer of zigbee2mqtt is a great guy and I enjoy contributing to his project.


Thank you for this wonderful explaining answer. So zigbee2mqtt seems to be worth a shot. Some questions.

a) Do i need to repair switching from ZHA to zigbee2mqtt. Already using Koenkk Firmware.
b) Does zigbee2mqtt run in Docker in bridge network? Which ports needs to be exposed? Checking the docs I did not find any references.

I run zigbee2mqtt in docker. Here’s my compose file. This runs on a remote raspberry pi 3B which I have strategically located for the best coverage. Also runs zwavejs2mqtt.

BTW: I set the version to run the latest development version as it has it’s own UI where the previous version I tried, I had to install Zigbee2MQTT Assistant for the UI.

version: "3"
    container_name: zwavejs2mqtt
    image: zwavejs/zwavejs2mqtt:1.3.0
    restart: unless-stopped
    tty: true
    stop_signal: SIGINT
      - zwave
      - '/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave:rmw'
      - ./store:/usr/src/app/store
      - '8091:8091'
      - '3000:3000'
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt:1.17.1
      - ./data:/app/data
      - /run/udev:/run/udev:ro
      - /dev/zigbe
      - '8080:8080'
    restart: always
    # network_mode: host
    privileged: true
      - TZ=America/New_York
    container_name: portainer
    image: portainer/portainer
      - portainer_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
      - "9000:9000"
    restart: always

"Power user” gotta try it now :laughing: :rofl:


What is the migration scenario? Is it pretty much starting over and redoing your automations and NodeRed flows?

If you can get your PAN id, network key, and channel from ZHA, then you can enter these into the zigbee2mqtt config. I think maybe then zigbee2mqtt will then pick up your devices, but I’ve never tried it. A lot has to go correctly for this to work so I wouldn’t count on it. You can also delete (unpair) devices from ZHA and the device should then try to re-pair, at which point you could start zigbee2mqtt instead.

I’m not sure about zigbee2mqtt in Docker because I run it on a VM instead. zigbee2mqtt listens on port 8080 for the web frontend and connects to an external MQTT server on port 1883 or 8883 (SSL).

I use AppDaemon direct to MQTT (I skip the HA middle man). But I expect you will need to tweak all your automations.

1 Like

I kept all my lovelace and node red automations, going in the other direction from z2m to ZHA. I deleted each device in turn as I re-paired each device, making sure I used the same entity names after re-pairing.

I really liked zigbee2mqtt integration but after losing firmware twice in CC2531’s I was done with it. Even when working it would have hiccups at least once a week. Sonoff ZB Bridge so far no such problems.


When I first started using zigbee2mqtt I used a spare CC2531. Honestly it didn’t work very well. I quickly moved to the CC1352P-2 and it’s been rock solid on the newer firmware.

1 Like

I probably should have gone that route but the Sonoff ZB Bridge was so cheap. I had a good experience porting my old RF sockets onto their RF Bridge. Same Tasmota flash process so that was easy, too.

Have to say I was pretty pleased with ZHA to pair & rename, etc., my Lidl, IKEA and Sonoff devices without a hitch.

Right now, IMHO, I think this is the best coordinator on the market.

I was about to ask the same question as the OP.

I don’t really understand why so many HA users go through the hassle of installing and configuring zigbee2mqtt over ZHA.

I can relate to the fact that it’s harder to add “quirks” to ZHA for devices that do not follow properly the zigbee specification, but adding zigbee2mqtt and MQTT to the equation to still end up in HA, over the built-in ZHA, seems like a waste of time and resources to me…
Especially for non-techie users, that’s a recipe for a lot of frustration, imho.

May be your looking at it wrong, zigbee2mqtt and even deconz can run independently to HA and be installed elsewhere. You then can restart each without having an affect on the other.

I run deconz for this very reason - independence from HA and running in Docker on a separate pi (along with Zwave to MQTT and MQTT itself.) I can do individual updates to components and worry much less about taking everything down for one.

Well, sure, if you run them on another machine and/or you use the MQTT messages for something else than HA, there is value in it, but it is not an argument if you run everything on a single machine.

Generally speaking, there is a lot of good reason for a zigbee2mqtt setup for experimented users.

Looking at the “Configuration” questions, I just see a lot of confused, not-so experienced users, using that setup :wink:

just as many with zha, it more likely they do not understand ZigBee in general.

Actually, they seem more confused with MQTT :wink:
Zigbee is basically transparent, whether you use one or the other. Or maybe you don"t need to know the basics of ZB to add a device in Z2M?

According to Home Assistant Analytics, MQTT is the #3 used Integration.
In my case, HA doesn’t have to be running for most of my automatons to function.