Using ZigBee Arrival Sensor with Multiple ZigBee Coordinator

Hi Everyone,

I just want to share a way where you can register the same Zigbee Devices to multiple hubs. Before we start, I apologize if the information becomes too long.

The motivation for doing this is that I make an Arrival Sensor for cars usable with hubs in different locations. (note: This configuration may also work with other ZigBee devices. This is why I make this separate thread. However, I tested this configuration with my own Arrival Sensor). When we have multiple locations with home automation systems, wouldn’t it be nice for the Arrival Sensor to be able to hop on from one hub to another? Perhaps, we have an office and home with a home automation system. This capability will allow us to use the same Arrival Sensor on those 2 locations. You can read all about my Arrival Sensor here.

Requirement for doing this is as follow:

  1. I only know how to do this with Zigbee2MQTT. But the basics may be applicable with ZHA. So for now Zigbee2MQTT is required.
  2. We must use the same ZigBee stick (perhaps only compatible with z-stack/TI stacks only). I use Sonoff USB 3.0 plus dongle on my hubs. I would say that the stick must be from the same model. CC2652X stick is probably not going to be compatible with CC253X.
  3. Each hub must not be within reception of each other.
  4. Each hub is its own independent hub. There is no sharing resources between hub. You will need to configure the automation independently from each other. It is only the sensor can joint on of the hub.

The theory behind it is simple. I create a duplicate ZigBee coordinator for each hubs so that the Arrival Senor can rejoin and send information to one of the registered hubs seamlessly. In Zigbee2MQTT, we can create a duplicate ZigBee coordinator because Zigbee2MQTT can replace ZigBee sticks when they are broken with the same stick. There is no need to re-pair the devices connected to it. Based on the above, here is what I did.

  1. I set up two Zigbee2MQTT instances.
  2. I pick one one them as the source instance. I copied the following information from the source to the destination instance.

Please make the following changes while your Zigbee2MQTT instance shutdown.

In configuration.yaml, I make sure the values that are pointed with the red arrow are the same between 2 hubs. I know that there is some private information below. These are my test hubs with my test devices. I do not have anything critical running in it.

In coordinator_backup.json, I make sure that the values pointed with the red arrow are the same between 2 hubs. Please make sure the values pointed by green are the same between 2 hubs. The green one should be derived from configuration.yaml. I believe what we are doing here is to make one of the sticks a duplicate of the other by copying its address and some internal information.

Depending on how you install your Zigbee2MQTT, the locations of those files may be different. I am not going to put the file location information here. Please make sure that you are familiar with how the Zigbee2MQTT instance is installed on your machine and make changes in those files.

WARNING: I would not do this on hubs with existing devices paired to it. The zigbee network where you duplicate the coordinator will need to re-pair its existing devices. I am giving this warning for convenience. I want to make sure that you don’t get to position where your have a lot of device paired and need pairing again

The above steps do not create a duplicate ZigBee environment. Each hub can have different devices paired to it. However, each hub will have the same ZigBee coordinator.

After restarting both hubs, you can pair the Arrival Sensor to one of the hubs. Then, you can factory reset the Arrival Sensor. You can follow with pairing the Arrival Sensor to the other HUB. That is all you need to do. The Arrival Sensor can hop from one to another hub.

Here is a demo of my test environment.

DISCLAIMER: This is not fully tested. With the short amount of time that I use it, I am not seeing any issue. But, it does not mean that there is no issue with this technique.

Thanks
Iman

4 Likes

One thing to keep in mind is that the two zigbee coordinators (‘sticks’) must not be within reception range of each other’s mesh. They must be completely isolated, except for communication by mqtt.

How are you getting the mqtt messages from the remote instance back to Home Assistant?

100% correct. I guess I did not make it clear in the post. I do stress it on the video. In my testing environment, I have to shut one hub while the other hub turned on.

Each hub has its own mqtt instance. In the Arrival Sensor case, It is just like the sensor move from one hub to the other. The hub is its own domain independent of the othe hub.

Yes but how do you get the remote mqtt messages back to home assistant?

I am sorry I don’t quite understand. I think there is a misunderstanding.

You can think of each of locations has its own home assistant. I just did not show both. I just show one home assistant for my hypothetical home hub. My hypothetical office hub has its own set home assistant with its own mqtt instance.

So, in the respective hub, you can have its own rule and automation. There is no connection between hubs.

The Arrival Sensor hop from one location to another sort of speak.

1 Like

Ah, I see now. I thought you only had one home assistant server and were just running zigbee2mqtt and an mqtt broker at the remote location. Then mqtt sent messages from remote → home.

1 Like

Got it. Sorry for the confusion. I am adding some info base on this to the original post so that it does not confused others.

1 Like

Just an update. I missed to document one step related to make the duplicate coordinator. The Zigbee2MQTT document it that we need to copied the mac address. Both coordinator stick need to have the same MAC address. This capability is only available in TI stick. Using TI tools Flash and Flash2, you can make a copy of the mac address from one stick to another.

Without copying the mac address, I found that it would work just fine for sometime. Then, it will stop working. Since, I make duplicate the mac address. I am able to get it running quite stable.

In my original post above, one of my step is that I am re-pairing my arrival sensor in the Zigbee mesh with the duplicated coordinator. This step is not necessary. I can just make copy the arrival device information from configuration.yaml, database.db and coorodinator_backup.json in both Zigbee mesh. They will work just fine without doing any re-pair. Just pay attention in the database.db. There is id for each device. Make sure that they do not confilict.

In any case, I would like to make sure that put the following disclaimer. In order to get it work, there are some manual file editing needed. There is no GUI to make it easy where you can just take one coordinator and move it to another. There is also no GUI to help copying a device from one Zigbee mesh to another.

In addition, I am testing this more in the lab setting. I have not introduced repeater in my test setup. I do not expect that there will be an issue. However, I have not test this idea with a real world Zigbee mesh.