I implemented the following code… and it works great, except the lights come on a little too early.
https://gist.github.com/emosenkis/dfca4f1653efb0bc8c1c74d26aa12249
And the elevation default is 5 degrees. I understand the default for sun elevation is 0 degrees, but is it possible to enter negative numbers i.e. to represent the lights coming on after sunset?