Skip to content

weather-voodoo: adopt OpenWeather One Call 4.0 — alerts now, 15-min nowcast later #43

Description

@radumarias

Context

weather-voodoo currently calls the One Call 3.0 endpoint (hardcoded in weather-voodoo/src/lib/server/openweather.ts). OpenWeather now recommends the Timeline-Based Weather API — One Call 4.0 for all new integrations (proprietary OWHL model, 10-min refresh, minutely + 15-min forecasts, 48h hourly, alerts).

Audit of what we actually consume today:

Data Source Status
Forecast, wind, rain, waves, UV Open-Meteo (free) working
AQI OpenWeather /data/2.5/air_pollution (free tier) working
Government weather alerts OpenWeather One Call blocked — needs One Call subscription (401 today)
OWM UV (uvIndexCurrent / uvIndexHourly) extracted server-side dead code — no client consumer; UV comes from Open-Meteo

One Call 4.0 cannot replace Open-Meteo as the forecast backbone: it has no marine/wave data (sea mode depends on it) and its hourly horizon is 48h while the today/tomorrow/day-after UI needs ~72h. Open-Meteo (ECMWF/ICON/regional models) stays primary; OpenWeather's unique value for us is alerts — and later, nowcasting.

Proposed changes

  1. Migrate openweather.ts from 3.0 → 4.0
    • Swap ONECALL_URL to the 4.0 endpoint; verify alerts[] (and hourly field names) against the 4.0 response schema.
    • Update the misleading error copy ("3.0 requires paid plan").
    • Subscription note: "One Call by Call" — 1,000 free calls/day; default cap is 2,000, set it to 1,000 in account settings to guarantee $0.
  2. Light up the alerts panel — already wired in FixedView.svelte; it just needs the subscription + working endpoint.
  3. Cleanup while there
    • Remove the unused uvIndexCurrent/uvIndexHourly extraction (UV is Open-Meteo's).
    • Optional: move AQI to Open-Meteo's free air-quality API (CAMS) so OpenWeather serves alerts only — fewer paid calls, one less legacy 2.5 endpoint.

Future (separate follow-up): "leaving right now" widget

4.0's minutely (60 min) + 15-min (48 h) nowcast is only valuable for near-term decisions ("do I leave now or in 20 minutes to dodge this rain cell"). The app's whole pipeline — ForecastHour, fusion, 3h blocks, trip-window scoring, share-link slot keys — is hourly by design, and converting it to 15-min steps is a large change for marginal benefit.

Instead: a small standalone "leaving right now" widget fed directly from the 15-min/minutely series (next 1–2 h precipitation/wind at fine grain), rendered independently of the hourly table. Complements the existing "Right now" trip-duration option. Any new UI text must follow the i18n workflow in weather-voodoo/CLAUDE.md.

Acceptance

  • /api/owm?kind=onecall returns available: true with alerts via One Call 4.0 (given a subscribed key)
  • Alerts render on the fixed-location tab; graceful {available:false} degradation unchanged without a key
  • Dead UV extraction removed
  • (Optional) AQI served keyless from Open-Meteo air-quality API
  • Nowcast widget scoped as its own issue when/if wanted

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions