Running 2 separate Zigbee networks - ZHA and Zigbee2mqtt simultaneously .Step by Step setup zigbee2mqtt network -

I have been trying to set up a second Zigbee network.
I have Zha running fine with over 20 devices.
The reason to add the zigbee2mqtt network is that it will allow me to incorporate or add devices that are not in zha or that have more parameters and control on zigbee2mqtt.

HA is running in a Raspi 4 with a 4Amp power supply.
I have two Zigbee adaptors, one being used on the ZHA network and one just plugged in. Both are Sonoff ZB Dongle Plus E.
I also have a Zwave adapter and a Bluetooth adapter, so Im using a USB hub that works perfectly will all that’s plugged in, including the Sonoff that’s running ZHA.

1- Aside from the fact that by dividing your Zigbee devices into two separate groups, the network won’t be as solid, is there any other minus?
2- I couldn’t find a clear guide to set up the second network ( Z2mqtt ), and I have been tinkering here and there with no results. (always “bad gateway”)
Any advice or help on this?
Tips from someone running both zha and z2mqtt?
Thanks!

2 Likes

Is there such a thing as a ‘solid’ zigbee network? I wish there was. Sorry to say it but I think you’ll be storing up a lot of troubles for yourself. You’ll have 3 networks using the available channels (assuming you have 2.4Ghz WiFi too), and you’ll need to maintain two blocklists to stop each sensor from joining the wrong network.

Agree - But as long as mantain the networks -devices -excluded and separated, there wont be any difference as just having one or the other, correct?

Zigbee networks are capable of tolerating a degree of overlap (in case your neighbour has one too) but I wouldn’t expect their co-existence to be painless. You’ll need to set a different PAN Id on the 2nd coordinator or at least check it’s been clever enough to get a unique one itself.

Out of interest how many devices are you planning to have in each network?

I run three zigbee nets on my HA (ZHA, z2m, and z2m-edge).

There are absolutely no issues doing so with just a little planning.

Zigbee ↔ zigbee interference issues are overstated, but be aware of and plan accordingly. WiFi interference is the real issue,. ZHA defaults to 15, Z2M defaults to channel 11, so there won’t be out of the box zigbee conflicts. Z2M’s zigbee 11 default is bad if using WiFi Channel 1 and may need to be changed.
image

It would be best to have separate zigbee channels, but if it comes down to hard choices, sharing zigbee channels would be better than having a zigbee-WiFi conflict.

@hunterdrayman is correct on setting pan_id. I always set the z2m pan_id, ext_pan_id, and network_key to something unique. I think ZHA does a better job at randomizing these than z2m, so you shouldn’t have any conflicts even with the default z2m config.

Conversely, not sure what @hunterdrayman means about needing blocklists, unless he keeps permit_join turned on in z2m, which I always considered a bad idea. I’ve never used a blocklist and don’t have any issues with devices joining the wrong net.

2 Likes

When you add a new end device to the network you can’t pre-set its network selection on the device itself. So you’ll have to disable joining, make an attempt at pairing, note its IEEE address in the logs and then tell your desired network to let it in and pair again. In zigbee2mqtt you can maintain blocklists/passlists so that re-pairing say, for debugging or after a battery change will be simpler. ZHA must have a way of doing this too.
On channel allocation, beware of local zigbee devices you have no control over. I discovered that my ‘smart’ electricity meter was using the zigbee2mqtt default channel to talk to its dashboard display (which I don’t use) and although I asked, my electricity supplier won’t disable their meter’s zigbee network. I ended up having to rig up a faraday cage with foil to stop it from interfering. For this reason I always would set the channel away from defaults if possible - although there’s not much room. As @jerrm say, it’s always a good idea to set your own network encryption key.

Thank you for your answer - I have it running and no problems at all-

I run two networks, ZHA and Zigbee2MQTT. The reason was I found many of my lights would only act as routers for other lights and were taking up valuable slots on the limited routers I had in the network. Also ZHA does not always play well with some manufacturers devices.

So I separated the lights, keeping them on ZHA and built a new network on Z2M first adding all the routers then slowly adding end devices. This seems to work a lot better and dare I say it almost rock solid.

Both ZHA and Z2M are running as Home Assistant Integrations including Mosquito.
I use the port “by-id” to differentiate the two coordinators as turning on or off the hardware can affect the port naming, both plugged into my NUC running Proxmox. Example for Z2M Configuration of port below.

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

One point I missed when I did it was on Z2M make sure you change the network key from the default as its a security issue if you don’t. Changing later means you have to repair all devices.

1 Like

If you are in the UK then shielding your meter may impact the gas meter as its connected via zigbee to the electricity meter. Change the channel of your network is a better solution even if its a bit painful.

1 Like

Thanks @jenx . I was careful to leave strategic holes for that and so it could it can phone home to update my readings. :grinning:

1 Like

Adrunner, did you have to change anything like pan id? and if so, can you explain more what you had to change. i will be attempting to add another zigbee network this weekend. so i would like to be prepared