Style the weather forecast after classic cable graphics

This commit is contained in:
Josh
2026-11-13 15:16:28 -05:00
parent ccec1e7044
commit 61bff9a6e6
4 changed files with 74 additions and 9 deletions

View File

@@ -84,7 +84,7 @@ class NWSWeather:
"current": observation_data,
"almanac": {key: local_time(daylight[key]) for key in ("sunrise", "sunset")},
"hourly": future_periods(hourly, now)[:6],
"forecast": future_periods(forecast, now)[:6],
"forecast": future_periods(forecast, now)[:7],
"alerts": [
{"event": alert["event"], "headline": alert.get("headline")}
for alert in alerts or [] if after(alert.get("ends") or alert.get("expires"), now)
@@ -116,7 +116,8 @@ def observation(body):
def periods(body, limit):
return [
{"name": item["name"] or local_time(datetime.fromisoformat(item["startTime"])), "start": item["startTime"], "end": item["endTime"],
"temperature": item["temperature"], "conditions": item["shortForecast"]}
"temperature": item["temperature"], "conditions": item["shortForecast"],
"daytime": item["isDaytime"]}
for item in body["properties"]["periods"][:limit]
]