2 instances of zigbee2mqtt in hass os

After a LOT of experimentation, I think I figured it out.

I have 14 mmWave sensors that are creating a LOT of traffic, so much, that it’s affecting my other automations, hence the need for a second Z2M instance.

These particular devices didn’t play nice with a second Z2M instance using the trailing"/" method, even with an external converter to handle the newer devices…it’s an ongoing battle with these things.

So…

I made the second instance an “Edge” version, figuring it would have the latest and greatest support.

Suddenly all my errors dissappeared and I now had 2 working instance, no errors and all devices showing up in their respective Z2M devices list.

However, what I couldn’t work out was why, under the HA > System > Devices tab, I could only see the zigbee devices from my second Z2M instance…even though I had configured a different base_topic in the Add On > Z2M > Config “mqtt section”…turns out, this is ignored and has to be set in the configuration.yaml for the respective Z2M instances.


Summary of what worked:

Install 1st instance of Z2M
      then go to…
           HA > Settings > Add On > Z2M > Configuration tab
      Edit the 2 sections, Options & Network as follows

Options

  • data_path - /config/zigbee2mqtt (this was the default path created for me)

  • socat - left this alone

  • mqtt - mqtt://192.168.20.15:1883 (this was my mosquitto address)

  • serial - /dev/ttyUSB0 (my first sonoff coordinator)

Network
port - 8485


Instance 1 notes

  • Mqtt, this is the section that confused me the most, I eventually stripped everything out apart from the server address, I added the details I needed later, in the configuration.yaml file as they were being ignored here.

  • This is the minimum details in the Z2M config tab that are needed to get Z2M running.


Second instance prep
You will have a folder in the HA file system for the first Z2M instance, as denoted above in the data_path.
Manually create a second folder for the second Z2M-Edge instance, this is so you can edit the configuration.yaml files independently later, I called mine, zigbee2mqtt2


Install 2nd instance of Z2M, Edge version
      then go to…
           HA > Settings > Add On > Z2M-Edge > Configuration tab
      Edit the 2 sections, Options & Network as follows

Options

  • data_path - /config/zigbee2mqtt2 (edit to point to the newly created folder)

  • socat - left this alone

  • mqtt - mqtt://192.168.20.15:1883 (same as first instance)

  • serial - /dev/ttyUSB1 (my second sonoff coordinator)

Network
port - 8486 (default is 8485, I incremented by 1 for the second Z2M-Edge instance)


Each instance will now have their own folder in the HA file system.
In each folder there will be a configuration.yaml file, we now need to edit these

Configuration.yaml - First instance

The only thing I changed was the mqtt section:
I added my username and password and most importantly of all, the base_topic, which was being ignored previously

mqtt:
  server: mqtt://192.168.20.15:1883
  base_topic: zigbee2mqtt
  user: mqttuser
  password: mqttpassword

Configuration.yaml - Second instance

I edited the same values, only this time, changing the base_topic to something different

mqtt:
  server: mqtt://192.168.20.15:1883
  base_topic: zigbee2mqtt2
  user: mqttuser
  password: mqttpassword

I made no further changes, including inside the settings section of the Z2M web UI, I just used out of the box.

4 Likes