I don’t understand how the sensor knows what to turn on and off.
You’re absolutely right – you do need to already have your lights connected to Alexa for this to work. You can have your lights connected to Alexa by using specific bulbs, having a specific outlet plug, or by having a specific light switch.
Once you have your light connected to Alexa, the motion sensor will sense activity and run a routine to turn on the light you have already connected to Alexa.
If you’d like to check out getting started with smart lighting, you can read the guide here.
Once you have the smart lighting, the setup guide for the motion sensing is here.
Hope that clears things up!