Determine child ID number

I have two plugins that I have written. One is a controller, the other a device to be controlled. When the startup routine is called for the controller, lul_device and luup.device return the correct ID for the controller.

However, when I go to “Create Device” to add the child plugin, lul_device and luup.device return the ID for the parent instead of the ID for the child device.

Is there any way to get the id for the child in the startup routine?

If not, is there any alternate way to run code when the device is created where I would know the correct ID of the child?

Thanks!