I have been playing with an Ikea Tradfri E1812 button, a Philips Hue bulb, and zigbee2mqtt. I see that when I bind the button's OnOff output cluster to the bulb's OnOff input cluster, the sniffed traffic indicates that the ZC sends a Bind Request to the button indicating the OnOff cluster and the source/dest endpoints + addresses. After this binding request succeeds, subsequent button presses send out a unicast ON command directly to the light bulb. So the binding operation alters the internal state of the Ikea button such that it knows to target the one specific light bulb that it is bound to.
I would like to make a similar button using the nrf52840. But I'm not sure how to handle the binding part. The provided light_switch example just iterates through the network looking for any available light bulb. I don't want to do it this way, because I have over a dozen light bulbs on this Zigbee network and I don't want the button to randomly pick one of them to turn on. Instead, I want my button to only target the one light bulb that it was explicitly bound to, through the controller's UI.
Is my application code supposed to query the binding table from zboss in order to see which device(s) to send its commands to? Is there an example of how to do this?