Multi-site lightning delay tracking with all-clear countdowns, radar, and heat-stress monitoring — for anyone who has to be at more than one field in an afternoon.
Single HTML file, no build step, no framework. Optional serverless backend for alerts when your browser is closed. Runs at $0/month.
This is a planning aid, not an official all-clear. It reads detected lightning strikes. Many athletic facilities use predictive horn/strobe systems that fire before the first strike exists — so this dashboard can show CLEAR while the horn is sounding.
The horn always wins. Defer to the facility's siren, strobe, or the official on site. Nothing here is a substitute for on-site instrumentation or for judgment.
Consumer weather apps show lightning strikes, but they show one location at a time and none of them run the 30-minute all-clear clock. If you cover several venues in a day, you end up switching between screens and doing the arithmetic in your head — at exactly the moment you're least able to.
Lightning Watch runs the clock for every site at once, and tells you which one clears first.
- Per-site 30-minute all-clear countdown, restarting on every new strike inside the radius
- All sites on one screen — see which is clear, which is waiting, and for how long
- Push notifications on state changes (delay started / all clear) via ntfy — free, no account
- Animated radar — 12 frames over 55 minutes, so you can tell "building toward us" from "moving away"
- Live strike plotting on a Leaflet map with geofence rings per site
- Heat index and WBGT with activity-modification bands, plus active NWS watches and warnings
- Adaptive polling that spends API budget only when weather or your schedule warrants it
┌──────────────────────────────┐
metered ─────► │ Xweather /lightning │──┐
└──────────────────────────────┘ │
┌──────────────────────────────┐ │ ┌────────────────┐
free ─────► │ NWS api.weather.gov │──┼──►│ Rule engine │
│ NOAA NDFD (WBGT) │ │ │ ───────────── │
│ Iowa State IEM (NEXRAD) │ │ │ haversine │
│ OpenStreetMap │──┘ │ 30-min clocks │
└──────────────────────────────┘ │ edge-triggered │
└───────┬────────┘
┌──────────────────────────┴─────────┐
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ lightning-watch.html│ │ worker.js (CF cron) │
│ browser dashboard │◄─── state ───│ KV + ntfy push │
└─────────────────────┘ (JSON) └─────────────────────┘
holds API secrets
The Worker exists for two reasons: it keeps the countdown running when no browser is open, and it holds the API credentials so the client never sees them.
| Source | Provides | Auth | Cost |
|---|---|---|---|
| Xweather (Vaisala) | Lightning strikes — position, time, polarity, amperage | client id + secret | Free tier, 10× multiplier |
| NWS API | Temperature, humidity, wind, active alerts | none | Free |
| NOAA NDFD | Gridded WBGT forecast | none | Free |
| Iowa State IEM | NEXRAD radar mosaic tiles | none | Free |
| OpenStreetMap | Base map | none | Free |
Five of six are keyless and unmetered. Only lightning data costs anything, which shaped the entire design.
Xweather's free tier is 15,000 accesses/month, but /lightning bills at a 10× multiplier —
so you actually get 1,500 queries/month, about 50 a day. Not remotely enough to watch the
sky continuously.
| Approach | Queries/month | Verdict |
|---|---|---|
| Naive — 1 call per site, every minute, all day | 21,600 | 14× over budget |
| Per-site calls, business hours only | 4,320 | 3× over |
| Centroid batching + adaptive polling | 1,280 | fits, $0 |
Three things get it there:
- Centroid batching — one query at the geographic centre of all sites with a 100 km radius, filtered client-side by haversine distance. Cost is O(1) in site count, not O(n).
- Adaptive polling — 30-minute standby, dropping to 3 minutes only when a site is on delay, strikes appear within 25 miles, or you press On site.
- Hard spend cap — checked before every request, so a runaway loop can't drain the tier.
The UI projects your monthly spend live from your current settings, so you find out you're over budget while configuring rather than mid-storm.
git clone https://github.com/WillC822/Lightning-Watch.git
cd Lightning-Watch
open lightning-watch.html # or just double-click itPress Demo to watch a simulated delay and all-clear without an API key or a single call.
For live data, get a free key at xweather.com and enter it in Settings. For phone alerts and always-on monitoring, see docs/SETUP.md.
Do not host
lightning-watch.htmlon a public URL with credentials saved in it. Anyone loading the page gets your key. Use the Worker — see SECURITY.md.
Sites are configured in the UI or in worker.js / wrangler.toml. Each takes a name,
coordinates, and a trigger radius:
[
{"name": "Young Pine Park", "lat": 28.49338, "lon": -81.23126, "radius": 10},
{"name": "Barber Park", "lat": 28.49678, "lon": -81.31833, "radius": 10},
{"name": "Airport Lakes Park", "lat": 28.46043, "lon": -81.31575, "radius": 10}
]All sites must fall within ~58 miles of their collective centre so one query reaches them all. The app validates this and tells you if it doesn't hold.
Stated plainly, because a tool like this is more dangerous when you trust it too far:
- Detection ≠ prediction. Facilities running predictive systems will horn before any strike exists for this to see.
- Modelled WBGT runs cool. Published comparisons put it ~1°C below field measurement, with 2–3°C gaps at high WBGT — the error is biased toward "safer than reality," precisely when that's most dangerous. It does not satisfy Florida's on-site measurement statute.
- Radar lags several minutes and shows precipitation, not electrical activity.
- Nearby sites report nearly identical conditions. Sites a few miles apart share most of a 10-mile geofence; expect them to agree most of the time.
- Free tier is genuinely tight. Continuous 24/7 coverage requires paying for overage.
| Doc | Contents |
|---|---|
| docs/SETUP.md | Full setup, Worker deployment, heat and WBGT reference, thresholds |
| SECURITY.md | Threat model, credential handling, known residual risks |
Vanilla JavaScript · Leaflet · Cloudflare Workers + KV · REST/JSON and DWML/XML parsing · TMS raster tiles. No build step, no bundler, no dependencies beyond a single CDN script tag.
MIT — provided without warranty. Read the safety notice above before relying on it for anything that matters.
