Turning off light when it's dark and printing

I currently have a relay and a stepdown module connected to the printer's power supply and controlled by the Pi, hooked up to a light to light up my prints.
I want the light to automatically light up when it's printing and it's too dark to see in the camera.
This can either be done based on the output from the camera (dark pixel percentage) or based on the time (or a combination of the time, my location or date).
Is there any plugin that does that right now?

I would think a simple photocell sensor would be the simplest approach. Somthing like https://pimylifeup.com/raspberry-pi-light-sensor/ would be inexpensive and simple to implement. Take a look at https://github.com/vitormhenrique/OctoPrint-Enclosure for the pi side.You might be able to leverage GPIO-Shutdown plugin by forking and modifying a few things.