Running Zigbee2MQTT and ZHA together

This has been asked before, but a long time ago, however I want to revisit it with a new angle…

I understand that Z2M and ZHA can be run on the same machine, so long as you have 2 coordinators and those coordinators only do one or the other

My extension of the question is,
a) can the coordinators be the same device (e.g. two Sonoff USB dongles)
b) are there any downsides (outside of the fact that these are two separate meshes) - will they interfere with each other (like wifi can?)

Ideally I’d like to stick with ZHA but I’ve found a few devices flakey or straight up not work, which do work now that I’ve switched to Zigbee2MQTT, however I’ve also got the opposite… so thinking for £15 for a new dongle maybe running both is the solution…

3 Likes

No issues on two of the same make/model dongles.

No interference issues as long as you keep separate zigbee channels. ZHA defaults to 15, z2m defaults to 11, so no out of the box conflicts.

WiFi conflicts would probably be a bigger issue than two zigbee networks clashing. See ZigBee and Wi-Fi Coexistence | MetaGeek , and plan accordingly.

1 Like

Thanks for that. I actually was looking at that the other day… I’m so congested on 2.4ghz here that I can’t really avoid the wifi interference (and it seems to work anyway :slight_smile: )

I’m not sure if I want to take the hit on the mesh, but at this moment having devices that work might be more of a priority

I think the value of the “mesh” is overstated. You just need a few reliably available, well placed routers.

For the secondary net, a well placed smart plug or two to fill in gaps can provide solid performance.

I have a sonoff zigbee stick and a Aeotec zwave stick on my pi4.

Zigbee stick is on a usb extension cable so its a little ways from the pi, not sure if I needed it or not, but kind of hard to plug in both sticks and anything else, so I like using an extension cable.

Works well for me.

I have this setup now, a sonoff wifi bridge with tasmota and a GW04.
The bridge is my coordinator for ZHA, and i am now starting to configure the GW04 for Z2M.
But somehow when i remove a device from ZHA and pair it with Z2M the device is connected to both after a while.
in both cases the device is very slow and sometimes even not responding at all, the device is close to the Z2M dongle.
If i remove it then in ether one of them, the device is gone in both.

other thing, and probably related.
i only permit join for 2 devices, but after 2 days there are already 10 devices available in Z2M, and all of them where already in ZHA.

there’s something wrong with my setup :face_with_thermometer:, but i can not find what the problem is.
Also zigbee2mqtt keeps on spitting these messages in the dashboard:
2023-03-27 19_52_02-Zigbee2MQTT – Home Assistant

Make sure each Z2M has a different PAN ID. Also make sure that permit to join is set to false on startup.

Also maybe a different channel, but the PAN ID should be enough.

2 Likes

I have 1 ZHA coordinator and 1 Z2M.
in Z2M i can configure the PAN ID, but i dont see that in ZHA.
for test i will change the PAN ID in Z2M, later today.

tested, yes, that fixed it.
thanks for the tip

1 Like

Hello Guys, i was reading this topic. because i want to use Zigbee2mqtt next to my existing ZHA setup.
I have a question, i noticed that since i have about 50 devices in my network. and plenty of routers. It still gets very slow with adopting a new device.
And now i have a 3 way switch in my bedroom. and its not responing properly. sometimes it seems like the message arrives 1 minute later and the lights start going on and off like there are ghostst.
The question is. When dividing your devices over 2 coordinators. Do you notice less strain on each individual coordinator. Does it run smoother.
I also wanna add it for 1 device not working on ZHA but i hope it will solve the (overloaded) zha network. i was hoping you can tell me more about this.
Uptill now i have minimal problems with devices not responding. Just adopting slowly. But in this room and with these devices(same brand , bseed) i have more problems. i tried using a (well working) router to adopt this switch , so that it is using a nearby router, but when i switch the light on and then back off, i can see home assistant will turn it off but on my dashboard it displays as on. and it gets unresponsive. i have also checked my wifi 2,4 ghz signal, its set to channel 6, and my 5ghz to auto. my zigbee channel to 25.

Hoping someone has a good idea, and hoping someone can tell me more about running the 2 coordinators if this will put less strain on the networks.

Thanks

1 Like

50 devices should not be anywhere near “overloaded” unless there are some unusually noisy devices on the net.

Zigbee is fickle, sometimes certain devices just don’t mix well. Having a second net to selectively move devices around and test certainly won’t hurt.

Oke guys, for anybody ever looking for this problem. I will make a short guide in to what i had to do to get this to work:

First install zigbee2mqtt.
Then make sure your adapter is seen. you can run the following command in the terminal of home assistant to see you adapter(s) make sure you have the right one.and type over to replicate my picture.
you will have to use the device id, behind a certain line.
I have tried just using the port like : ttyACM0, but this didnt work for me.

So when you will run this command in terminal: ls -l /dev/serial/by-id

you will be able to see a line with a device id simular to my picture.
And make sure, if you have the sonoff dongle, to add in the ‘‘adapter: ezsp’’
This is important.

After that, you will have to change your config.yaml
Go to file editor/ zigbee2mqtt and in that folder to configuration.yaml

Remove all numbers behind: Network_id, Pan_id, Ext_pan_id

And make it like this
network_key: GENERATE
pan_id: GENERATE
ext_pan_id: GENERATE
channel: 25

i used 25 (same as my ZHA integration and works fine. but you could try another channel if you want)

Also, somewhere in the bottom of the yaml. file i added this:

permit_join: false

i read that this was sometimes nessecery, not sure if it is but you can try.

save it, reboot (yaml only will do i think)
And then restart zigbee2 mqtt and it should work)
If i missed a step, try some things you will read on these topics. But these where the things that helped me because i had to figure out how it works using 5 different forums.
Good Luck.

thanks jerrm, i got it working after somme fiddling

How/where do I find the PAN-ID in my Z2B console?
My configuration.yaml doesn’t have any such information in it…

Settings → advanced

Indeed! Many thanks.
Same PAN-ID as you have: 6754 and ZB Channel: 20
When I check my Phoscon (ConBee II), its PAN-ID says : 0x4Da2 and ZB Channel: 11
I understand what ZB channels mean, but what exactly do these PAN-ID mean?

From PAN ID

PAN ID

Zigbee networks are called personal area networks (PANs). Each network is defined with a unique PAN identifier (PAN ID), which is common among all devices of the same network. Zigbee devices are either preconfigured with a PAN ID to join, or they can discover nearby networks and select a PAN ID to join.

Zigbee supports both a 64-bit and a 16-bit PAN ID. Both PAN IDs are used to uniquely identify a network. Devices on the same Zigbee network must share the same 64-bit and 16-bit PAN IDs. If multiple Zigbee networks are operating within range of each other, each should have unique PAN IDs.

1 Like

Hello, I recenty tried running them both together with 2 different dongles (Sonoff dongle E for z2m and Skyconnect for ZHA) but what happens is that after some point the zha coordinator settings are being changed by the z2m ones. Can someone please provide advice for this? Some more info. In the past my ZHA radio was the dongle-E and I migrated to skyconnect. What I see is that my skyconnect zha and the dongle -e z2m have the same IEEE. I don’t know if that matters.

It does matter, because the IEEE is what Zigbee devices use to connect to the coordinator.

So that’s the reason why it keeps changing my settings? Because after a while I get all zha devices unavailable and an error message that me zha settings were changed

Hello everyone! I have a Home Assistant Yellow with its integrated CP2102N radio running on ZHA. I have 37 devices running on this network, and they work fine.

I got some new Sonoff SNZB-03P (PIR motion sensors with light sensor) that can be fully used if connected to Z2M (The light sensor is not reported if connected to ZHA, also with ZHA you cannot configure the sensor’s motion timeout). I have other Zigbee motion sensors with the same problem, so I would like to switch them to Z2M (less than 6 devices total).

I have a spare Sonoff ZBDongle-P (which I believe uses a CC2652P radio). I used this radio before having the HA Yellow, I had a smaller network and I decided to migrate all my devices manually to the Yellow radio using ZHA.

Now I would like to keep the Yellow’s radio with ZHA as it is currently, and add Z2M to use with the ZBDongle-P to take full control of these new devices.

Based on my system info, ttyUSB0 is the Yellow’s radio and ttyUSB1 is the ZBDongle-P

Now when I go to ZHA Configuration, it says
/dev/ttyAMA1 - Serial port. Is this correct?

I installed Zigbee2MQTT.

serial:
  port: >-
    /dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0

When I run it with the above setting, Z2M starts, but when trying to permit join, it either gives this error:
SRSP - ZDO - mgmtPermitJoinReq after 6000ms’
Or it takes long to add a device (the device shows up as unsupported) and then it crashes:

[2024-09-23 11:05:09] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x842712fffe7e405e","ieee_address":"0x842712fffe7e405e"},"type":"device_announce"}'
Error: ZCL command 0x842712fffe7e405e/1 ssIasZone.enrollRsp({"enrollrspcode":0,"zoneid":23}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"reservedBits":0,"writeUndiv":false}) failed (Data request failed with error: 'MAC no ack' (233))
    at ZStackAdapter.sendZclFrameToEndpointInternal (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:482:23)
    at Queue.execute (/app/node_modules/zigbee-herdsman/src/utils/queue.ts:36:20)
    at Request.send (/app/node_modules/zigbee-herdsman/src/controller/helpers/request.ts:82:20)
    at Endpoint.zclCommand (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:911:28)
    at Endpoint.command (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:683:23)
    at Device.onZclData (/app/node_modules/zigbee-herdsman/src/controller/model/device.ts:393:13)
    at Controller.onZclPayload (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:843:13)

I made sure that my networks have a different PAN ID (didn’t need to modify anything there).

If I add adapter: ezsp to the configuration, it fails to start:

[11:16:27] INFO: Preparing to start...
[11:16:28] INFO: Socat not enabled
[11:16:30] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2024-09-23 11:16:36] info: 	z2m: Logging to console, file (filename: log.log)
[2024-09-23 11:16:36] info: 	z2m: Starting Zigbee2MQTT version 1.40.1 (commit #unknown)
[2024-09-23 11:16:36] info: 	z2m: Starting zigbee-herdsman (0.57.3)
[2024-09-23 11:16:37] warning: 	zh:ezsp: Deprecated driver 'ezsp' currently in use, 'ember' will become the officially supported EmberZNet driver in next release. If using Zigbee2MQTT see https://github.com/Koenkk/zigbee2mqtt/discussions/21462
[2024-09-23 11:16:47] error: 	zh:ezsp:uart: --> Error: Error: {"sequence":-1} after 10000ms
[2024-09-23 11:16:47] error: 	zh:ezsp:ezsp: Connection attempt 1 error: Error: Failure to connect

As the error mentions switching to ember, I tried setting adapter: ember it also fails to start and shows these errors:

[2024-09-23 11:20:37] info: 	z2m: Logging to console, file (filename: log.log)
[2024-09-23 11:20:37] info: 	z2m: Starting Zigbee2MQTT version 1.40.1 (commit #unknown)
[2024-09-23 11:20:37] info: 	z2m: Starting zigbee-herdsman (0.57.3)
[2024-09-23 11:20:38] info: 	zh:ember: Using default stack config.
[2024-09-23 11:20:38] info: 	zh:ember: ======== Ember Adapter Starting ========
[2024-09-23 11:20:38] info: 	zh:ember:ezsp: ======== EZSP starting ========
[2024-09-23 11:20:38] info: 	zh:ember:uart:ash: ======== ASH Adapter reset ========
[2024-09-23 11:20:38] info: 	zh:ember:uart:ash: RTS/CTS config is off, enabling software flow control.
[2024-09-23 11:20:38] info: 	zh:ember:uart:ash: Serial port opened
[2024-09-23 11:20:38] info: 	zh:ember:uart:ash: ======== ASH starting ========
[2024-09-23 11:20:41] info: 	zh:ember:uart:ash: ======== ASH Adapter reset ========
[2024-09-23 11:20:41] info: 	zh:ember:uart:ash: ======== ASH starting ========
[2024-09-23 11:20:43] info: 	zh:ember:uart:ash: ======== ASH Adapter reset ========
[2024-09-23 11:20:43] info: 	zh:ember:uart:ash: ======== ASH starting ========
[2024-09-23 11:20:46] info: 	zh:ember:uart:ash: ======== ASH Adapter reset ========
[2024-09-23 11:20:46] info: 	zh:ember:uart:ash: ======== ASH starting ========
[2024-09-23 11:20:48] error: 	zh:ember:uart:ash: Received frame with comm error
[2024-09-23 11:20:48] info: 	zh:ember:uart:ash: ======== ASH Adapter reset ========
[2024-09-23 11:20:48] info: 	zh:ember:uart:ash: ======== ASH starting ========
[2024-09-23 11:20:51] error: 	z2m: Error while starting zigbee-herdsman
[2024-09-23 11:20:51] error: 	z2m: Failed to start zigbee
[2024-09-23 11:20:51] error: 	z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
[2024-09-23 11:20:51] error: 	z2m: Exiting...
[2024-09-23 11:20:51] error: 	z2m: Error: Failed to start EZSP layer with status=HOST_FATAL_ERROR.
    at EmberAdapter.initEzsp (/app/node_modules/zigbee-herdsman/src/adapter/ember/adapter/emberAdapter.ts:701:19)
    at EmberAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/ember/adapter/emberAdapter.ts:1708:24)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:138:29)
    at Zigbee.start (/app/lib/zigbee.ts:64:27)
    at Controller.start (/app/lib/controller.ts:140:27)
    at start (/app/index.js:154:5)

When I go to zigbee2mqtt/configuration.yaml file I don’t see any network_key, pan_id, ext_pan_id or channel entries. Should I try to add these here with the word Generate?

I’d be thankful for any input on how to continue here!
Rodrigo