@@ -631,8 +631,8 @@ def analyse_forecast(
631631
632632 Args:
633633 forecast: Forecast data from weather client
634- panel_capacity_kw: Panel capacity for weather-based solar estimation
635- weather_client: WeatherClient instance for hourly solar calculations
634+ panel_capacity_kw: Panel capacity (unused, kept for compatibility)
635+ weather_client: WeatherClient instance (unused, kept for compatibility)
636636 solar_client: SolarForecastClient for accurate solar predictions
637637 min_solar_threshold: Minimum solar kWh to consider a "good" day
638638 """
@@ -642,17 +642,19 @@ def analyse_forecast(
642642 daily = forecast ["daily" ]
643643 bad_weather_days = []
644644
645- # Try to get solar forecast from forecast.solar first
645+ # Try to get solar forecast from forecast.solar
646646 solar_forecast = None
647647 if solar_client :
648648 solar_forecast = solar_client .get_forecast ()
649649 if solar_forecast .get ("success" ):
650650 logger .info ("Using forecast.solar for solar predictions" )
651+ elif solar_forecast .get ("is_temporary" ):
652+ logger .warning ("forecast.solar temporarily unavailable (rate limited or timeout)" )
651653
652654 for day in daily :
653655 date_str = day .get ("date" , "" )
654656
655- # Priority 1: Use forecast.solar if available
657+ # Use forecast.solar if available
656658 if solar_forecast and solar_forecast .get ("success" ):
657659 for solar_day in solar_forecast .get ("daily" , []):
658660 if solar_day ["date" ] == date_str :
@@ -663,27 +665,14 @@ def analyse_forecast(
663665 else :
664666 day ["estimated_solar_kwh" ] = None
665667 day ["has_solar_prediction" ] = False
666-
667- # Priority 2: Fall back to weather-based estimation
668- if not day .get ("has_solar_prediction" ) and panel_capacity_kw and panel_capacity_kw > 0 and weather_client :
669- hourly_estimate = weather_client .estimate_solar_output_hourly (
670- panel_capacity_kw ,
671- date_str
672- )
673-
674- if hourly_estimate is not None :
675- day ["estimated_solar_kwh" ] = hourly_estimate
676- day ["has_solar_prediction" ] = True
677- day ["solar_source" ] = "weather_estimate"
678- else :
679- day ["estimated_solar_kwh" ] = None
680- day ["has_solar_prediction" ] = False
681-
682- if not day .get ("has_solar_prediction" ):
668+ day ["solar_source" ] = None
669+ else :
670+ # No API prediction available - don't fall back to weather estimate
683671 day ["estimated_solar_kwh" ] = None
684672 day ["has_solar_prediction" ] = False
673+ day ["solar_source" ] = None
685674
686- # Determine if bad weather based on solar prediction
675+ # Determine if bad weather based on solar prediction or weather conditions
687676 if day .get ("has_solar_prediction" ) and min_solar_threshold :
688677 is_bad = day ["estimated_solar_kwh" ] < min_solar_threshold
689678 else :
0 commit comments