Rain Alert
A hyperlocal rain forecast alert with a public live status page.
category: technical · tags: Python, Weather, ntfy, Cron
Rain Alert checks an hourly weather forecast for a specific location and sends a push notification when rain above a set threshold is expected within a defined window of the day — a “should I bring an umbrella / move the outdoor plan” check that runs itself instead of requiring a manual weather-app check.
What it does
- Pulls hourly precipitation forecasts for a fixed lat/long and evaluates them against a configurable threshold (mm/h), active time window, and a “worsening” factor so a forecast that gets meaningfully worse re-alerts even during a cooldown period.
- Pushes an alert via a self-hosted ntfy instance when the threshold is crossed, with a cooldown so it doesn’t spam repeat alerts for the same rain event.
- Publishes a public live status page showing the current all-clear/rain-expected state, with a staleness check that flags it if the cron job hasn’t run recently.
Technology & approach
- Core logic: Python, with the threshold/window evaluation kept as pure, unit-testable functions separate from the forecast-fetching and notification I/O.
- Scheduling: cron, running several times a day rather than continuously — a rain forecast doesn’t need second-by-second polling.
- Notifications: the same self-hosted ntfy + cron pattern used by Tyre Price Compare and other automations on this site.
- Status page: a static page reading a small JSON status file written on each run — no database needed for something this lightweight.
A small proof of concept for a pattern that generalizes well: cheap, self-hosted condition-monitoring with a push alert, rather than reaching for a SaaS weather app.