Tradfri On/Off, Only able to pair three bulbs

When pairing Tradfri on/off switches I am able to pair a variable number of bulbs. With one switch I was able to pair 4 or 5 previously. Now with another I am able to pair only 3 and with a third I am able to pair only 1.5.

When doing the pair I watch my homeassistant logs with zigpy.log set to debug.

A successful bind for one bulb looks like this in the logs

2022-02-16 21:55:47 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] processing cluster: 6 Bind_req --> [0c:43:14:ff:fe:bf:6a:4d]
2022-02-16 21:55:47 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] processing cluster: 8 Bind_req --> [0c:43:14:ff:fe:bf:6a:4d]
2022-02-16 21:55:49 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] cluster: 6 Bind_req --> [0c:43:14:ff:fe:bf:6a:4d] completed: [<Status.SUCCESS: 0>]
2022-02-16 21:55:49 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] cluster: 8 Bind_req --> [0c:43:14:ff:fe:bf:6a:4d] completed: [<Status.SUCCESS: 0>]

As I pair each bulb after a while is see something like this

2022-02-16 21:55:53 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] processing cluster: 6 Bind_req --> [0c:43:14:ff:fe:cb:c5:61]
2022-02-16 21:55:53 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] processing cluster: 8 Bind_req --> [0c:43:14:ff:fe:cb:c5:61]
2022-02-16 21:55:54 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] ZDO request ZDOCmd.NWK_addr_req: [0c:43:14:ff:fe:bf:6a:4d, 0, 0]
2022-02-16 21:55:56 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] cluster: 6 Bind_req --> [0c:43:14:ff:fe:cb:c5:61] completed: [<Status.TABLE_FULL: 140>]
2022-02-16 21:55:56 DEBUG (MainThread) [zigpy.zdo] [0x82c7:zdo] cluster: 8 Bind_req --> [0c:43:14:ff:fe:cb:c5:61] completed: [<Status.TABLE_FULL: 140>]

I can create space by unbinding the co-ordinator and bind an extra bulb with no loss in function. However eventually I hit the table full error again.

The variable results makes me think something is clogging up the table - perhaps orphaned devices that have since left and re-joined the network and so can’t be unbound - it seems unlikely that the different switches would actually have different table sizes.

Is there a way to print or wipe the binding table? I have tried unbinding each device and doing ‘reconfigure device’

Unfortunately factory resetting the on off buttons is not an easy option for me as they are installed in the wall :confused:

Solution:

As confirmed in How to clear binding table? · Issue #922 · zigpy/zigpy · GitHub the binding table was full for the switch (16 entries). Binding a device will occupy as space for each cluster that is bound - likely 2 per device. 3 - 5 entries are taken up by the coordinator depending if you unbind it in ZHA (unbinding does seem to have any side effects).

So one should have 16-3 = 13 remaining entries. Enough for 6 lights.

The variable results makes me think something is clogging up the table - perhaps orphaned devices that have since left and re-joined the network and so can’t be unbound

A bound lightlink group with many clusters was occupying the binding table. Unbinding each lighlink group using ZHA provided all the spaces I needed. I was then able to bind 4 lights to the switch.

FYI, the ZHA docs now finally have some information explain basic concept for binding and unbinding:

https://www.home-assistant.io/integrations/zha#binding-and-unbinding

It would be great if you guys could help improve/extend the ZHA docs by submitting PRs similar to this:

https://github.com/home-assistant/home-assistant.io/pull/16336

For changing the existing docs and submitting a new PR with improvements check out zha.markdown:

https://github.com/home-assistant/home-assistant.io/blob/97731860f5401dadef45cf37755281f8a25dc064/source/_integrations/zha.markdown

Adding more information about bindings limitations could be a good start in improving the ZHA docs.