Very cool. I’ll check this out.
I wrote it in a manual here: GitHub - nielsfaber/scheduler-card: HA Lovelace card for control of scheduler entities
In programming like this we always do things in reverse.
So the first condition should be after SUNSET - because that’s only true once. Then you do after SUNRISE - that way after sunset will match first (after sunset) and be executed, whereas as other people have pointed out - the way you have it once sunrise has happened, it will always match that first - even at sunset.
EDIT: But using the sun elevation is a better way of doing it - because sunset can be already be quite dark in the winter but quite light in the summer.