Zigbee ZHA, are multiple coordinators possible?

Ok, so I could use two bridges then. I would however need four, or maybe three if I use conbee & deconz in the location of my HA instance.

The more I think about my use case, the more I’m leaning to Shelly devices, so I can use only one method for interacting with devices,

It would be nice to have possibility to have multiple ZHA instances, but maybe this is not very common usage.

With native Tasmota ZigBee you can have as many Sonoff ZbBridges as you want, since they use mqtt they don’t disturb each other. It is only ZHA that has a problem.

1 Like

Ok. I’ll take look at it, thanks!

think i’m going the deconz route, apparently, someone runs it two in different locations so will be interesting, I also find that the tasmota zb bridge is a bit buggy for now and keeps forgetting stuff / multiple issues, the pi running zigbee2mqtt and with a cc2531 was solid but no longer an option now it’s all in hyper-v, looking forward to deconz / pi / conbeeii.

ZHA integration so far only support one Zigbee coordinator. Also see these similar requests:

https://github.com/zigpy/zigpy/discussions/673

https://community.home-assistant.io/t/zha-multiple-co-ordinators/255101

https://community.home-assistant.io/t/zha-multiple-gateway/262101/

https://community.home-assistant.io/t/zha-support-for-more-than-one-zigbee-coordinator-in-zha/258248/

https://community.home-assistant.io/t/zigbee-zha-are-multiple-coordinators-possible/224050

https://community.home-assistant.io/t/multiple-sonoff-zigbee-bridge/264491

1 Like

Actually, there is an elegant way to do it. If you see my long post it may look discouraging, but just read it carefully, and try it for happy results.

For those who still have the question of “mesh over wifi with 2 zb bridges”: You can only use a second(or a third) zbBridge to extend Zb to Zb, but not over WIFI/LAN, therefore when you have an isolated area, the only solution is to use a totally separated Zb Network on a second bridge.

This is how i did it:

My setup - all on a Synology Diskstation(but it could work just the same on a Raspberry Pi):

  • Home Assistant on Docker(no supervisor, therefore no Add-ons) - I assume you have it already
  • MQTT Broker on docker - I assume you have it already
  • 2 separate containers running an instance of Zigbee2MQTT for each individual bridge
  • 2 Sonoff ZbBridges, both flashed with Tasmota

The 2 Zigbee2MQTT containers/services, are reading the data from the 2 ZB Bridges over IP(see configuration.yaml), and pushes the data into my only real MQTT Broker which is running on docker. And since everything from my MQTT Broker is available in HA, that was it… easy-peasy.

Now that the concept is clear, here is the docker-compose.yaml and the config files from the two zigbee2mqtt instances, and some instructions on how to replicate the setup:

  1. Let’s create 1 folder called zigbee2mqtt, then 2 sub-folders inside of it. Each sub-folder will contain only one file - the configuration.yaml for each of the bridges. In my case I have called the two sub-folder “data_keller” and “data_home” since I have a zbBridge inside home and another one in keller(underground)

  2. Inside the zigbee2mqtt folder create the following docker-compose.yaml file:

version: '3.8'
services:
  zigbee2mqtt_zbBridge_keller:
    container_name: zigbee2mqtt_zbBridge_keller
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    volumes:
      - ./data_keller:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 38080:8080
    environment:
      - TZ=Europe/Berlin # adapt if different location
  
  zigbee2mqtt_zbBridge_home:
    container_name: zigbee2mqtt_zbBridge_home
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    volumes:
      - ./data_home:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 38081:8080
    environment:
      - TZ=Europe/Berlin # adapt if different location

# even though permit_join: false, new devices can be added through the UI: http://<docker_host>:3880 -> Settings ->Permit Join - check box and uncheck after joining the device !!! don't let it active, otherwise your unwanted devices will be paired automatically.
  1. Inside the two sub-folders, create a configuration.yaml with the following content(of course, adapted for your network):
homeassistant: true
permit_join: false
frontend: true
mqtt:
  base_topic: zigbee2mqtt_<room_name_where_the_bridge_is_located>
  server: mqtt://<your_mqtt_broker_ip_without_port_number>
  include_device_information: true
serial:
  port: tcp://<your_tasmota_zb_bridge_ip>:8888
  adapter: ezsp
advanced:
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
device_options:
  legacy: false
  1. Make sure you are in the zigbee2mqtt folder you just created at step 1, and execute docker-compose up -d on your docker host and it should just work

Mentions:

  • Both zgbee2mqtt instances can be operated from the Web Interface. Open the browser, and type the docker_host_ip and the port number configured on your configuration.yaml. In my case, synology is the host so: http://192.168.1.5:38080. → play around and have some fun
  • base_topic in configuration.yaml can be fully customizes; it does NOT have to start with zigbee2mqtt_. However, if you have multiple bridges, make sure each bridge have it’s own base_topic.
  • permit_join: false in my configuration.yaml may be confusing, but I control that parameter from the WebUI and I don’t keep it True to avoid joining unwanted devices… Zigbee can quickly become a mess.
  • configuration.yaml may / will be different when you try to open it from time to time; the reason is that if you configure something from the Web UI, it will be changed in the configuration file… so a simple docker restart will not reset the Zigbee2MQTT to the configuration you initially wrote in your config file.
  • this setup works with both HA in docker container or HA with supervisor… since the ZB(devices + bridges + zigbee2mqtt) are only communicating with your MQTT Server.
  • all devices will be available in HA through the MQTT integration, therefore you can get rid of your Zigbee integration.
  • if there are some docker beginners reading this, watching a few youtube videos about “first steps in docker” or “docker-compose how-to” could quickly provide the necessary knowledge.
  • all private details(ip addresses, etc.) have been modified or censored

If i am mistaken somewhere, or something does not work to you, let me know in a comment.

1 Like

While it is not supported you could in theory also have several separate instances of the ZHA integration component. At least you should be able to do so today as a workaround in order to have multiple instances of the ZHA integration component, but it would be a very hacky solution as users would need to manually copy the zha component to a new folder/directory and edit the manifest JSON file on the second copy so that both its domain and name are named something else which are unique, which in practice would make it into a completely separate integration component, (though I believe doing so might mess up the USB discovery and Zeroconf discovery functions for initiation the config flow).

Same need as the OP here. I think it may be a common need for who lives in an apartment or where the garage is out of the main Zigbee coordinator and repeaters-chain reach.

In my garage I’ve a working Wifi transparent connection to my apartment LAN, by using an old OpenWrt Wifi AP bridged with my apartment AP ([OpenWrt Wiki] Wi-Fi extender / repeater / bridge configuration)

Waiting for a better solution, I’m installing Zigbee2mqtt on an old spare RasPI, which is connected to my LAN via the garage bridged AP.

These times it’ isn’t common to have a spare RasPI :wink: so a better solution will be useful for who lives in an apartment.

Piero

1 Like

Don’t use an rpi then, there are plenty of computers out there. Something you find in a skip will probably do it. Orange Pi seem to be available.

1 Like

Tip there is there are also network-attached Zigbee Coordinator adapters for “remote” installation so can install Zigbee2MQTT anywhere else on local network including inside a virtual machine or a container:

If use WiFi then recommendation is to get a CC2652P based one as they handle drops a little better:

https://www.zigbee2mqtt.io/advanced/remote-adapter/connect_to_a_remote_adapter.html

https://www.home-assistant.io/integrations/zha#warning-about-wi-fi-based-zigbee-to-serial-bridgesgateways

1 Like

Hi,

I just started using these network connected coordinators. SLZB-06 Zigbee Ethernet PoE LAN USB WiFi Adapter CC2652P | Zigbee2MQTT | Home Assistant | SMLIGHT | SMLIGHT Official Homepage I so far have one Sonoff ZB-Dongle-P connected to my mini PC running HA under proxmox. And three network connected SLZB-06 devices. I have them installed in different area’s of my house which is made of solid concrete and the Zigbee signal, just like Wifi does not penetrate the floors or the walls. Therefore I aslo use many wired ubiquti Unifi mesh accesspoints to get wifi everywhere. So I have set-up these coordinators on different 2.4 ghz channels just to prevent interference in area’s where the signal might overlap. And so far I have no issues. So these multiple coordinators all have their own instance of Z2mqtt running under HA. The only issue I came across that it is a bit of a pain to add multiple instances of Z2mqtt via the add on store since it sometimes tells you the addon is already installed. Only by tricking the system by adding another / to the repository adress and using http instead of https I sofar managed to install 4 instances of z2mqtt. They all report into the same mosqito broker so all zigbee connected items on the different zigbee networks can talk to each other via HA. The only thing you need to do is use a different base topic for every coordinator. And thats where I had some problems. Even if you put a different base topic in the z2mqtt configuration screen the setting in the MQTT tab still show zigbee2mqtt. So apparently there is a bug in the system that whatever you put in the configuration screen it does not use. But if you change it in the MQTT tab it works fine. You also need to set a different Pan Id for each z2mqtt instance in the advanced options in the configuration file. and set the chanel ad the same place. So a couple of updates form the creators of z2mqtt would make installation painless. Enable installing multiple instances of z2mqtt without having to trick the system, and repairing the bug that does prevent the basetopic set in the configutation file to be used in the setup. And if this is not clear, please forgive me I am a newbe that has no clue how it all works under the hood, so only managed to make this work by trial and error.

interested in more regarding this setup… have my main setup running off an extended USB dongle to my HA server. I’m interested in running a 2nd instance of Z2M (edge addon?) to connect to a ZigStar UZG01 (network/poe connected) at my barn and another in my remote house… all of which are very long distances from my main setup.

finally got my PoE SMLight [SLZB-06] sticks, programmed the first one.
now that it is connected using Z2M Edge, I’m no longer seeing my devices that are paired to my USB Zigbee coordinator.

Made sure to have the new coordinate topic as zigbee2mqtt_1 and not seeing any issues in the logs.

Any tips to what I might need to update?

UPDATE: Just needed a reboot instead of a restart. Took a couple min and everything came rushing in. Will get my 3rd coordinator deployed tomorrow in my barn and life should be great! Appreciate the recommendation on the SMLight PoE device, they are great!

1 Like

Hei Anton,
I think I am running a very similar setup. but with a raspi.
And I am a bloody novice in the mqtt basics.
Can you name me the positions, where you changed the configuration, so that I can also have the slzb-06 talking to the mosquitto broker?
Thanks in Advance,
Markus

Can any of you three who apparently have managed to get it working please write a step-by-step tutorial?

I have a CC2531 connected to my PC that is running HA Supervised on a Debian – in the ground floor.

I would like to add another coordinator in the first floor, as the Zigbee signal just cannot get there.

My entire house is connected by wired and wireless LAN.

I liked ZHA much more than Z2M.

Since I need only one more coordinator, I take it that:

I cannot add another ZHA to the same HA instance.

Can I add a Z2M to the same HA instance? This is what it seems you guys have done, but the instructions are somewhat vague.

Is 1 ZHA + 1 Z2M easier than 2 Z2M?

Which standalone coordinator do you recommend? I tried the Sonoff one and did not like it. Kept disconnecting devices (unlike the rock solid CC2531).

Thank you very much.

Yes.

Just be sure to use the /dev/serial/by-id naming convention for the port assignment in both ZHA and z2m. Linux can change the “ttyUSBx” names somewhat randomly when multiple USB devices are connected.

Otherwise, nothing special needs to be done. Just follow any of the z2m install guides that can be found elsewhere online.

Not really, but there are some “tricks” required to run multiple z2m addon instances:

  • Run one standard addon instance and one edge instance. This can be simplest since both are included in the addon repo.

  • Fork the addon repo in github, setup auto syncing, and add your new repo to the HA addon store. Forking a github repo is really very easy, again multiple online tutorials.

  • Add the standard z2m addon repo multiple times to the HA addon store. The trick here is to add an extra trailing “/” to the url, ie: “https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/” and “https://github.com/zigbee2mqtt/hassio-zigbee2mqtt//”. I had four instances installed just as a test at one point (using multiple trailing slashes), so theoretically there is no limit to the number of instances with this hack. Biggest risk is the HA devs decide to deem this a url parsing bug and “fix” it.

For z2m, a cc2652p based stick with 20221226 or earlier firmware. I use the Sonoff ZBDongle-P on multiple HA locations, all rock solid.

I’m migrating to a new HA instance, but want to keep the old one running until the new one is setup. The old one uses a Conbee II stick.
The new HA instance will have a new smilight coordinator.
Can I connect/pair zigbee devices to both coordinators at the same time? Or can devices only be paired to one coordinator?

Only one pairing.

I have one more reason for 2 coordinators: resiliency.
I have my coordinator in barn, some time ago it have gone off. So whole network is down. I suppose rat chewed USB cable or USB port got broken. I don’t know yet for sure as it is remote location.

for the less tech savvy , is there a guide on a step by step process to add a 2nd coordinator device (skyconnect in my case) , make it a 2nd coordinator and integrate in the main ZHA installation?

alternatively , setup the skyconnect as Z2Q on a separate raspberry but then make the devices of Z2Q visible in the main ZHA installation via some type of integration

Thaks a million