Files
Paperwall/web/templates/settings_weather.html
T
Honey 889c062212 Make weather update interval configurable, was hardcoded to 30 min
Screen.poll_interval was a fixed class attribute the scheduler read
directly -- added Screen.get_poll_interval(settings) so a screen can make
it settings-driven instead. WeatherScreen overrides it to read a new
"update_minutes" field (default 30, matching the old hardcoded value).
New number input on the Weather settings page.

Caught a real edge case while testing: `raw or 30` treats an explicit 0
as falsy and silently replaces it with 30 instead of clamping to the
1-minute floor. Not reachable via the UI (min="1" on the input) but the
method should still be correct standalone -- fixed with an explicit
None-check instead.
2026-07-22 20:14:46 +02:00

55 lines
2.3 KiB
HTML

{% extends "base.html" %}
{% block content %}
<h1>Weather</h1>
{% if error %}
<div class="toast error">{{ error }}</div>
{% endif %}
<form method="post">
<div class="card">
<div class="section-label">Location</div>
<p class="hint" style="margin: -0.25rem 0 1rem;">Uses Open-Meteo &mdash; no API key needed.</p>
<div class="field">
<label for="city">City</label>
<input type="text" id="city" name="city" placeholder="e.g. Berlin">
{% if settings.city %}
<p class="hint">Currently: {{ settings.city }} ({{ settings.latitude }}, {{ settings.longitude }})</p>
{% endif %}
</div>
</div>
<div class="card">
<div class="section-label">Forecast</div>
<div class="field">
<label for="forecast_days">Days to show</label>
<select id="forecast_days" name="forecast_days">
<option value="3" {{ "selected" if settings.forecast_days == 3 or not settings.forecast_days }}>3 days</option>
<option value="5" {{ "selected" if settings.forecast_days == 5 }}>5 days</option>
<option value="7" {{ "selected" if settings.forecast_days == 7 }}>7 days</option>
</select>
</div>
<div class="field">
<label for="update_minutes">Update every (minutes)</label>
<input type="number" id="update_minutes" name="update_minutes" min="1" value="{{ settings.update_minutes or 30 }}">
<p class="hint">Weather itself only refreshes the panel when something actually changed, so a shorter interval here mostly just means fresher data, not more flashing.</p>
</div>
</div>
<div class="card">
<div class="section-label">Or enter coordinates manually</div>
<p class="hint" style="margin: -0.25rem 0 1rem;">Leave the city field above empty to use these instead.</p>
<div class="field">
<label for="latitude">Latitude</label>
<input type="text" id="latitude" name="latitude" value="{{ settings.latitude if settings.latitude is not none else '' }}" placeholder="e.g. 52.52">
</div>
<div class="field">
<label for="longitude">Longitude</label>
<input type="text" id="longitude" name="longitude" value="{{ settings.longitude if settings.longitude is not none else '' }}" placeholder="e.g. 13.40">
</div>
</div>
<button type="submit">Save</button>
</form>
{% endblock %}