Add pirateweather.net backend#231
Conversation
Agent-Logs-Url: https://github.com/schachmat/wego/sessions/2287fbf8-7d43-4320-8352-1670e35c0c1a Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
…cal vars Agent-Logs-Url: https://github.com/schachmat/wego/sessions/2287fbf8-7d43-4320-8352-1670e35c0c1a Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
|
@copilot add a section to the README.md for how to configure pirateweather. Ensure any other documentation is up to date. |
Agent-Logs-Url: https://github.com/schachmat/wego/sessions/d01ce9fe-eb03-46c1-81e5-e47ae24ea0fe Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
Done in f180c4a. Added |
|
@copilot resolve any lint issues and also investigate/resolve this parsing mistake: "2026/04/12 00:59:18 Failed to unmarshal pirateweather response: json: cannot unmarshal number -999 into Go struct field .flags.nearest-station of type uint" |
…eweather API Agent-Logs-Url: https://github.com/schachmat/wego/sessions/0de82b82-bbfb-4bc3-b9e9-ff4bf68dca4f Co-authored-by: kordianbruck <298860+kordianbruck@users.noreply.github.com>
Fixed in 3d38283. The |
Implements the pirateweather.net weather backend (finishing PR #194), fixing several bugs in the original before merging.
Motivation and Context
Adds support for pirateweather.net as a weather data backend. The original PR had correctness bugs and unfinished code that prevented it from being merged.
Description
Bug fixes from original PR:
precipIntensitymm/h → m/h (÷1000),visibilitykm → m (×1000),windSpeed/windGustm/s → km/h (×3.6) — SI units from the API require all three conversionstoForecastrefactor: replaced 7 copy-pastedif numdays > Nblocks (each with a straylog.Println("1")debug statement) with a loop grouping hourly data by day boundary; also fixed month-boundary detection using year+month+day comparison instead of day-of-month onlyjson.MarshalIndent(body, ...)on a[]byteemits base64, not JSON — replaced withstring(body); API key redacted from logged URLpanic()→log.Fatal()to match other backends; added missing API key presence checkflags.nearest-stationandelevationchanged fromuinttoint— the API returns-999as a "not implemented" sentinel fornearest-station, and elevations can be negative (below sea level locations)Code style:
PirateweatherConfig→pirateweatherConfig, etc.) to match conventions in other backendsDocumentation:
pirateweatherto the backends list in the Features section ofREADME.mdREADME.mdunder Backends, with a link to sign up for a free API key and a sample.wegorcconfigSteps for Testing
Obtain a free API key from pirateweather.net and run:
Test with
-pirateweather-debugflag to verify debug output doesn't expose the API key and correctly prints the JSON response body.Screenshots