i was on same track for visualization of dynamic energy prices.
My solution (that works) uses the “sunpower” forecast of a German weather forecast (DWD). I transformed every forecast with sunpower > 0 to zero and everything else to max of my graph.
interesting approach, but for my situation it’s not possible because I don’t live in Germany (so DWD is not availiabe).
In my openweather forecast I don’t have a sunpower and I think the sunpower value isn’t similar with the sunset/sunrise, or? (and what’s happen on foggy days?)
You could try to use UV index in OWM or a solar forecast. Both match sunrise/sunset quite good (±30min). For a visualization this should be precise enough.