Add OpenWeatherMap weather forecasts. Closes #48

Show 8-day Bristol home weather on the index and weekends pages.
Show destination weather per day on the trip list and trip page.
Cache forecasts in ~/lib/data/weather/ and refresh via update.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-02-21 20:27:25 +00:00
parent 61e17d9c96
commit b4f0a5bf5d
7 changed files with 217 additions and 0 deletions

View file

@ -377,6 +377,30 @@
</div>
{% endfor %}
{% if trip_weather %}
<div class="mt-3">
<h4>Weather forecast</h4>
{% set ns = namespace(has_rows=false) %}
<table class="table table-hover w-auto">
{% for day, elements in trip.elements_grouped_by_day() %}
{% set weather = trip_weather.get(day.isoformat()) %}
{% if weather %}
{% set ns.has_rows = true %}
<tr>
<td class="text-end text-nowrap">{{ display_date(day) }}</td>
<td><img src="https://openweathermap.org/img/wn/{{ weather.icon }}.png" alt="{{ weather.status }}" title="{{ weather.detailed_status }}" width="25" height="25"></td>
<td>{{ weather.temp_min }}{{ weather.temp_max }}°C</td>
<td>{{ weather.detailed_status }}</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% if not ns.has_rows %}
<p class="text-muted">Forecast not yet available (available up to 8 days ahead).</p>
{% endif %}
</div>
{% endif %}
<div class="mt-3">
<h4>Holidays</h4>
{% if holidays %}