Super simple blue print to turn on the lights if the illumination condition is fulfilled.
I use it in my hallway, to only turn on the hallway lights when it is dark enough. So the lights will only turn on when they are needed.
Play around with the luminance threshold and set it to your liking
Here is the gist with the code.