any of the *Radar scripts that are in src/NetworkStorage src/PlutoStorageDevices, or src/BootScripts can serve as an example.
Basically, you find the devices using whatever method you wish, then you parse that data, and turn it into parameters for a Device Detected event, and send the message using MessageSend.
Device Detected events have a number of parameters that serve as constraints, and they are all ANDed together, ranging from MAC address, to an explicit device template #, to vendor/model ID pairs, etc.
The only thing needed would be a Generic USB Camera, which would create on the same machine, a motion wrapper, and as part of the script, re-set the parent device of the USB camera from the computer to the motion wrapper, along with device data tweaks so the appropriate behaviour would happen.
There is a script that does the latter in the tree, as part of Motion_Wrapper, but I forget what it is called.