I’ve used gpio on various SBCs to drive small signal relays on a few projects, but never any high-current, high-voltage stuff. The principle is exactly the same, I just hadn’t used it before. The elegoo 37-sensor kit I just got had a handy break out board for a 10A 250VAC relay. I used a gpio line on a pine64 to drive the relay coil using a PN2222A transistor circuit. The script is no different than blinking an LED.
Next, I controlled the relay by reading the voltage drop across a photo resistor voltage divider using an MCP3004 10-bit ADC. When the OP code from the ADC rose above 400, the light comes on (because it is dark).