diff --git a/screens/weather.py b/screens/weather.py index 20408c7..057ff49 100644 --- a/screens/weather.py +++ b/screens/weather.py @@ -96,7 +96,11 @@ class WeatherScreen(Screen): "current": "temperature_2m,apparent_temperature,weather_code", "daily": "weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max", "hourly": "temperature_2m", - "forecast_days": forecast_days, + # +1: forecast_days is "how many upcoming days in the daily + # strip", and today itself is dropped from that strip below + # (already shown big up top) -- so fetching just + # forecast_days would leave the strip one day short. + "forecast_days": forecast_days + 1, "timezone": "auto", }, timeout=HTTP_TIMEOUT, @@ -127,6 +131,10 @@ class WeatherScreen(Screen): "low": daily["temperature_2m_min"][i], }) + high_today = days[0]["high"] if days else None + low_today = days[0]["low"] if days else None + days = days[1:] # drop today -- already shown big up top + rain_chance = None probs = daily.get("precipitation_probability_max") or [] if probs and probs[0] is not None: @@ -148,8 +156,8 @@ class WeatherScreen(Screen): "description": description, "kind": kind, "days": days, - "high_today": days[0]["high"] if days else None, - "low_today": days[0]["low"] if days else None, + "high_today": high_today, + "low_today": low_today, "rain_chance": rain_chance, "hourly_today": hourly_today, }