ZHA and Zigbee2MQTT on the same LAN Zigbee coordinator

Who is running ZHA and Z2M on the same LAN coordinator ? I’d be very interested to read your feedback.
→ what device / chipset are your running ??

I’m actually looking for advices from some Zigbee2MQTT expert !

This article shows how to configure Z2M and ZHA to work with a single LAN zigbee adaptor:

The author first configure the zigbee network under Z2M, and then install a new ZHA. Upon install, zha detects that the pan id, key… have changed and popup an error message with an option to adopt the new params (those from Z2M)

The problem is that I have 100+ devices on ZHA, so I have to proceed in the reverse order (ZHA first, then Z2M). That’s the only difference with the article.

To configure Z2M on the same zigbee network, it’s easy, I just had to remove coordinator_backup.json, and modify configuration.yaml (in z2m not in ha) with the params from ZHA :

  • coordinator ieee
  • pan id
  • extended pan id
  • network key

Everything work fine untill ZHA and Z2M are run at the same time. In this case Z2M starts and run for a minute before crashing.
I can see in my LAN zigbee adapter that 2 sockets are open.
Then Z2M crashes with the following log:

[2024-05-22 21:59:40] error: 	zh:ezsp:uart: --> Error: Error: {"sequence":6} after 4000ms
[2024-05-22 21:59:40] error: 	zh:ezsp:uart: -!- break waiting (6)
[2024-05-22 21:59:40] error: 	zh:ezsp:uart: Can't send DATA frame (5,7,0): 3d000164000efdff0100
[2024-05-22 22:00:06] error: 	zh:ezsp:uart: Unrecognized frame FrameID 258
[2024-05-22 22:00:06] error: 	zh:ezsp:uart: Error while parsing to NpiFrame 'Error: Unrecognized frame FrameID 258
    at Function.createFrame (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/ezsp.ts:145:19)
    at Ezsp.onFrameReceived (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/ezsp.ts:439:35)
    at SerialDriver.emit (node:events:517:28)
    at SerialDriver.handleDATA (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/uart.ts:250:14)
    at SerialDriver.onParsed (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/uart.ts:174:22)
    at Parser.emit (node:events:517:28)
    at Parser._transform (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/parser.ts:49:26)
    at Parser.Transform._write (node:internal/streams/transform:175:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)'

Any help / advice would be more than welcome :slight_smile:

My understanding is that it can’t be done. I have zha on one coordinator, z2m on another, and zwave on a third.

Can be done only with lan adapter. See the link

Ok got the UZG-01 over Ethernet, got all devices in both MQTT and ZHA. Question is, how should I handle all the doubled up devices and entities? A few I have experimented with using a helper to combine the same entity into one e.g. temp MQTT and temp ZHA Helper with hide member enabled, seems to work well but when doing the same thing with motion and using that with turning lights on off automation, the lights seem to go off sometimes. Any suggestions on best practices for this setup.

Many are smart things sensors of various versions, main reason for MQTT is the Lutron knobs for hue, am trying to get rid of the hue hub and binding the knob to lights in MQTT worked well for small groups of lights but would begin to fail binding after more than 3, would retry and sometimes it would add the power or dimming functions but was inconsistent. If was able to bind all with all features in MQTT would work great. Then hue updated all buttons knobs with super easy to use smart on off and scene selection via hue app hub and am debating on moving the few rooms that were test bed for MQTT ZHA back to the hue hub. Whole purpose was to make a huge rock solid mains zigbee network with about 90 hue bulbs and several dimmers and switches in addition to the devices I had prior to moving from smarthings.

When you installed your adapter, did you first configure ZHA or Z2M ?

As I see things, each device should be on ZHA or Z2M and disabled on the other platform to avoid conflicts or useless operations.
The advantage is to be able to choose the best platform for each device based on compatibility and implemented features, while having a unique mesh network including devices managed by both platforms.

I just realized that my z2m params are ok.
Z2M runs fine as long as it’s alone.
Crash occurs when Z2M and ZHA are running at the same time.
→ I edited my first post

@keenanjmoore : what is your version of UZG-01 ?
The chipset of UZG-01 was modified after hardware version 0.2

As your device seem to work fine I will buy the same.

May I ask why you would want this? To me it seems like a big bag of trouble having multiple connections to the coordinator. :slight_smile:

1 Like

Sure, this is the explanation: I have 120+ devices in a big house, a garden… in a mesh network including many routers.
Most of the devices run perfectly under zha.
But some of them need z2m and those devices are dispatched everywhere.
Of course I could have 2 different networks one with zha, the other with z2m. But I would need to double all the routers having each time one for zha, one for z2m.
So it’s much simpler having one unique network running both zha and z2m.

Why not just migrate to Z2M?

I simply want the best of both worlds :slight_smile:
The reason is that some devices have a better integration under zha.
And supposing it takes 3 mins per device (repairing, recreating entities with the same name) = 3x 120 = 6h work.

I˚m not sure you would be getting that though, but I would love to be proven wrong :blush: I get that 6 hours of repairing isn’t ideal, but those 6 hours could be dwarfed by time spent troubleshooting a setup where you force ZHA/Z2M to run on the same coordinator. Good luck at least!

No pain, no gain :smiley:
Can I ask you what is your personal knowledge / experience with zigbee ?

You are trying to convice me to change my plan and you do it with a strong self assurance. I guess that’s because of a good technical knowledge or a long experience of zigbee network configuration.
I’m sure such an experience could me usefull to help me manage to configure this dual network.

As example, I’m now investigating the chipset. I flashed the latest version and switched to z2m / ember instead of ezsp. Still no succes but I’ll try with the community driver. Next step I’ll switch to a different chipset. Your technical assistance would be useful as I’m far from an expert :slight_smile:

Nothing special, been using Zigbee for around 6-7 years I guess. Different software and coordinators (not tried ZHA).

I have a technical background :slight_smile:

By chance do you have an ethernet zigbee coordinator? I guess you are using z2m ?

Yes, I use Z2M on the UZG-01.

Great! what is the chipset on your device? They upgraded the firmware after hardware version 0.2

I have the P7.

Great, that’s the new version. I was about to buy this adapter to make some test but you may save me a lot of time.
What about trying to install zha on ha ? You can just follow this article, the did it with an UZG-01:

As you already have Z2M installed (not like me), it will be very easy, you just need to install zha and answer ‘keep current network’ when it will popup.

If zha and z2m are working fine together, you will see in your adapter web gui “socket connected: 2” and that will be great!

If like me, z2m and zha can’t coexist, you will see one of the following:

  • z2m will display red alert messages and may crash,
  • or zha will enter in “initializing” and stop working.
    → as soon as you stop one of them the other will work fine.

Anyway it won’t disturb your zigbee network and you will easily return back uninstalling zha.

What do you say?

Sorry, but I don’t see the need of running both of them. Like I said this seems like a bag full of trouble. I might save you some time doing it, but it will cost me time. :slight_smile: