I want to use astro to switch on/off a light at sunrise/sunset

You could use the do only if not daylight like here: