Minutes before/after Sunrise/Sunset Control

It already exists in the happens automatically part of a standard Hello Home Action. NOT the controls for the individual light. No custom code required. Not sure that meets your use case, of course.

See the following topic for screenshots.