My suggestion is to avoid the collision check cause rs485 was not designed to detect a collision in a reliable way. Of course you could design your own hardware, but commercial tansceivers ICs are not suitable.
So let's immagine a simple scenario for both the addressing and the installer.
The master device will turn on and do this:1) Broadcast (address 0) an hello message 2) Waits for replies 3) If someone replies "I'm new" send the address in broadcast 4) Do stuffs addressing slaves (his main job) 5) Waits for the answer 6) go to 1
The slave device will turn on and do this:1) Do I have an address? If NO switch to wait for address state else we are in normal slave mode 2) Waits to be addressed 3) Answer request 4) go to 2
In "wait for an address state":1) Wait for master hello 2) Reply "I'm new" 3) Wait for the address broadcasted 4) switch to normal slave mode
The scenario is simplified 'cause the only fullfillment you should take is to connect one new device at a time. Maybe you can provide an address reset button in each slave to be readdressed and a massive ping in the master loop to find who's lost.