How turn off lights automatically?
A relay lets you control AC circuits with low voltage. Do your research to find a safe one and how to use them safely. To detect human presence you could use a camera yes, but if you look into motion detectors I think you'll find them a lot easier to use. And here's a link to one example of that.