Trouble adding more than 30 devices via Zigbee2MQTT

Hoping someone can give me some advice here.

I’m running Home Assistant Green, with a Sonoff Dongle P via Z2M. I’m running into a problem where Z2M simply won’t adopt any device after around 30. 21 of those are Sengled lights, the other 9 are either Third Reality or IKEA Tradfri outlets. LQI on everything is 90+, and viewing the map shows that the lights are distributed fairly evenly through the routers, with only the outlets talking directly to the Sonoff Dongle coordinator.

Attempting to adopt any further devices fails, no matter whethet I try Permit Join All or a specific router - no error, it just never even starts an interview.

There’s nothing wrong with the devices I’m trying to adopt - I’ve tested them via a separate dongle (SkyConnect) using ZHA instead of Z2M. I’ve also tested by deleting an adopted device, and Z2M will then lets me adopt one of the devices that previously wasn’t even attempting to adopt without a problem, but won’t let me re-add the one I deleted.

Anyone have any suggestions?

Update - I’ve also now tried connecting 20 different router capable devices to the coordinator, then starting to add end devices after verifying that they all were showing strong signal. Same problem, hits 30 devices, refuses to adopt more from any method even through they’re in range of multiple routers AND the coordinator.

I’ve also tried daisy chaining router devices until they no longer saw the coordinator, only other routers, to absolutely ensure that new devices had to connect to a router, and tried adding new devices. Same problem, hits 30 total, refuses to adopt more.

What devices are you trying to add, mains powered or battery powered ?

I don’t think Sengled lights are routers, so the small size of your network may be contributing to this.

Also, when you delete a device from Z2M there’s an option that stops it pairing again - have you got that switched on?

Correct. That is why I asked what devices he tries to join.

Either. It won’t adopt anything after the 30th device, regardless of whether it’s mains or battery, and regardless of the distance from the new device to any router, including the coordinator. It’s like it’s hitting some max device limit somewhere. I’ve tried Adopt (all), I’ve tried adopting specifically from the Ikea or ThirdReality plugs, doesn’t matter what I choose.

No. And this happens with devices that have never been paired. Literally anything past the 30th. I can re-pair any of the devices freely as long as I have 29 entries or less in the Devices page - the second I add the 30th device, it stops adding new devices.

And is it really that sensitive to router vs end device? I’m running a 1:3 ratio right now (9 routers and 1 coordinator, 21 end devices (the Sengled lights) with solid connections everywhere, how many routers vs dedicated end devices do I actually need?

It depends entirely on the layout and structure of your home - there isn’t an optimum ratio - but yes, Zigbee can be very sensitive to the number of routers.

Apart from issues of range and interference, there’s a limit to the number of devices a router can connect to. Lots of good advice here:

What firmware is it on ?

Not useful. Read the rest of my post.

You did not answer my question about the firmware version.

Anyway, this is a script I had to use a long time ago

Sorry, was responding to the guy that just linked me a generic article that clearly wasn’t my problem.

Firmware version is 20230507. I can give that Python script a shot, but it sounds like it addresses a different issue than the one I have.

if you mend me, that “generic” article is the documentation for the ZHA integration, describing the “limitations” and what to do about it ( in specific “around 30 devices” )(a CC2652-based Zigbee coordinator )

Yes. According to that article, with a coordinator and nine routers, I should be able to support significantly more than 30 devices, particularly as I’ve confirmed that most of the devices are connecting indirectly through routers, and only the nine router-capable devices are connected directly to the coordinator. If I was using ZHA. Which I’m not. I’m using Z2M.

if you do it right , yes

Feel free to describe “doing it right”. I go into Z2M, select Enable Join (router I want), the device joins, visualization map confirms new device is routing through the router chosen and not connecting directly to the coordinator.

Is there another procedure? Something else I can check? Every indication is that I have a total of nine devices connected to the coordinator directly, everything else is going through routers to get there.

Python script didn’t help. Same problem.

That’s not how it works. You can join through a particular router to start with, but devices change their connections all the time - you can’t control when or where. A strong network is characterized not by the lines you can see on the map (which is only a snapshot) but by the number of possible connections a device could have. (The ZHA map is better in this respect because it shows all the connections Zigbee has discovered, not just the ones it is using.)

I think you’ve hit a wall because nine routers is not enough for the situation you’re in (situation meaning layout and structure of building, interference from wi-fi etc., type of router (some are better than others), and so on. Get a couple of those little USB “repeater” routers and try them in different positions to see if they make a difference.

Yeah, done that. I noted in the update to my original post that I’ve actually tried unpairing everything, pairing twenty router devices, then trying to pair end devices. Same result. Hits 30, refuses to adopt any new devices.

Even if that was the problem, if I’m trying to adopt a new device that’s in range of… basically all, of the routers including the coordinator, it should find a path through at least one of them. Literally nothing is happening. Like this isn’t a weird thing with intermittent connectivity, slow/failed adoption, etc., it’s very much as if the second a 30th device is added, the network immediately refuses to add any further devices.

I see you asked the question here, and on reddit. Maybe ask it too where you have most chance of success :