The sensor of my cam, can turn on the spotlight connected to the sonoff?

Hi, how could I program Home Assistant for this function?:

When my cam (click here for see my Reolink cam) detects the movement, the Home Assistant automatically turn on the spotlight connected to the sonoff, but I would like it to be enabled only when in my position it is already very dark or night.

Have you tried the sun entity in your automation that will control when it’s dark out