Connect to existing Zigbee network

I’ve just installed zigbee2mqtt and I want to connect to my existing zigbee network. I’ve entered pan id, ext pan id, channel and the network key into the config, but my devices are not showing up. Paring is also enabled.

I’ve already tried this with the com.zsmartsystem.zigbee library before and there the software was able to detect the device without resetting or rejoining them. Is this also possible with zigbee2mqtt?

Edit: I’ve also tried to pair a Innr bulb by resetting it, but I got the following error:
Error while parsing to ZpiObject 'TypeError: Cannot read property ‘updateLastSeen’ of undefined

I found a workarround for my problem. I modified the controller.js in the zigbee_herdsman module so that when a device is announced it is automatically added to the devices. To do this I made the following changes to the onDeviceAnnounce method:

onDeviceAnnounce(payload) {
    debug.log(`Device announce '${payload.ieeeAddr}'`);
    const device = model_1.Device.byIeeeAddr(payload.ieeeAddr);

    if (!device) {
        this.onDeviceJoined(payload);
    }

With this change I only have to disconnect and reconnect my lamps and then they are automatically added as new devices and they are working!

But I have now a different problem. I tried to group some of my Philipps Hue lamps, but when I send a command to a group all my lamps react to the command. In the description of the group configuration I found an info that a broadcast is sent for groups and that the lamps itself must know to which group they belong. I don’t know how the Hue bridge handles this. Is this something that simply doesn’t work for hue lamps?

I’ve now also used my code change to take over the network from my CC2531 coordinator to the CC1352P-2 coordinator that just arrived yesterday and it also worked perfectly. So I added an issue on the GitHub page to request that this will be added to the main repository:

With the CC1352P-2 I now get better performance when switching big groups of lamps than with the official Hue bridge! But the group commands are still switching all my lamps. So I guess this is something that does not work with Philipps Hue lamps or is at least only used to control all of the lamps at once.

I now also found out why the group commands did not work as expected. My lamps already had a bunch of groups configured and if the groups are only configured in the config file the software will assume that the lamps already know to which group they belong.

One solution to this is that there ist an “remove_all” mqtt command for the lamps that removes all groups. After that the lamps have to be added using the add mqtt command. With this command a configuration is sent to the lamp and it will be assigned to the group.

The solution I chose is just to try out different group id’s in the configuration until the right one is found. I had to try out 30 numbers until I got to a group id that was not used. I guess the Hue Disco app did create a whole bunch of groups. :slight_smile:

This looks awesome, thanks for the work. I’m also in the process of transitioning from cc2531 to the CC1352P-2. I’m wondering if you’re doing all of this on a Raspberry Pi? What’s your host machine?

I tried following these instructions recently to get Z2M working on a Pi, but it failed to start with the CC1352P-2. I used these instructions when I set up the CC2531.

Did you used some other set of instructions?

I’m using a Raspberry Pi 4 and I didn’t have to install anything. Maybe the device is under powered. Take a look at the dmesg messages after plugging the device in. The CC1352P-2 seems to need quite a lot of power and I attached it to a powered usb hub.