Repository navigation
Keep weather units accurate when wttr.in is unavailable - #21397
Merged
Merged
Conversation
The panel picked metric or imperial from wttr.in's nearest_area country, and with coordinates configured only Open-Meteo answers the current conditions, which carries no country. A wttr.in failure therefore left reportCountry empty and the unit fell through to the session locale, so an Australian location read as °F on an en_US session until wttr.in came back. weather.json now carries the place's ISO 3166-1 country code: the panel stores the geocoder's country_code with the coordinates it pins, and geo.omarchy.org already answers with one, so an auto-detected place has it too. Units follow that code before wttr.in's report and the locale. Closes #17415
countryUsesImperial knew Liberia and Myanmar by name only, so the codes weather.json now stores (LR, MM) fell through to metric. Both are listed alongside their names, with tests. Also spell out --country in the manual, which promised the units without showing how a CLI-pinned place gets one.
When wttr.in fails after a location change, the previous location's cached wttr.in report could still supply areaInfo.country for the new location, flipping units if the new location carried no saved country. Track the query that produced the current wttr.in report so stale areaInfo never bleeds across location changes, reject unknown flags in omarchy-weather-location --set, and add a focused unit and CLI test matrix covering degraded provider combinations (geo.omarchy.org, Open-Meteo, wttr.in outages, saved country codes, and LC_MEASUREMENT).
Contributor
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryKeeps weather units tied to the selected place when wttr.in is unavailable.
|
emirb
added a commit
that referenced
this pull request
Dec 3, 2026
* Keep weather units on the pinned location's country The panel picked metric or imperial from wttr.in's nearest_area country, and with coordinates configured only Open-Meteo answers the current conditions, which carries no country. A wttr.in failure therefore left reportCountry empty and the unit fell through to the session locale, so an Australian location read as °F on an en_US session until wttr.in came back. weather.json now carries the place's ISO 3166-1 country code: the panel stores the geocoder's country_code with the coordinates it pins, and geo.omarchy.org already answers with one, so an auto-detected place has it too. Units follow that code before wttr.in's report and the locale. Closes #17415 * Read the imperial countries by their country codes too countryUsesImperial knew Liberia and Myanmar by name only, so the codes weather.json now stores (LR, MM) fell through to metric. Both are listed alongside their names, with tests. Also spell out --country in the manual, which promised the units without showing how a CLI-pinned place gets one. * Respect LC_MEASUREMENT and LC_ALL for weather unit selection * Drop stale wttr.in country on location change and add weather unit tests When wttr.in fails after a location change, the previous location's cached wttr.in report could still supply areaInfo.country for the new location, flipping units if the new location carried no saved country. Track the query that produced the current wttr.in report so stale areaInfo never bleeds across location changes, reject unknown flags in omarchy-weather-location --set, and add a focused unit and CLI test matrix covering degraded provider combinations (geo.omarchy.org, Open-Meteo, wttr.in outages, saved country codes, and LC_MEASUREMENT). --------- Co-authored-by: Reese Royster <reeseroyster@pm.me> Co-authored-by: Mikhail Turov <groldster@gmail.com> (cherry picked from commit 322523c)
emirb
added a commit
that referenced
this pull request
Dec 3, 2026
) * Keep weather units on the pinned location's country The panel picked metric or imperial from wttr.in's nearest_area country, and with coordinates configured only Open-Meteo answers the current conditions, which carries no country. A wttr.in failure therefore left reportCountry empty and the unit fell through to the session locale, so an Australian location read as °F on an en_US session until wttr.in came back. weather.json now carries the place's ISO 3166-1 country code: the panel stores the geocoder's country_code with the coordinates it pins, and geo.omarchy.org already answers with one, so an auto-detected place has it too. Units follow that code before wttr.in's report and the locale. Closes #17415 * Read the imperial countries by their country codes too countryUsesImperial knew Liberia and Myanmar by name only, so the codes weather.json now stores (LR, MM) fell through to metric. Both are listed alongside their names, with tests. Also spell out --country in the manual, which promised the units without showing how a CLI-pinned place gets one. * Respect LC_MEASUREMENT and LC_ALL for weather unit selection * Drop stale wttr.in country on location change and add weather unit tests When wttr.in fails after a location change, the previous location's cached wttr.in report could still supply areaInfo.country for the new location, flipping units if the new location carried no saved country. Track the query that produced the current wttr.in report so stale areaInfo never bleeds across location changes, reject unknown flags in omarchy-weather-location --set, and add a focused unit and CLI test matrix covering degraded provider combinations (geo.omarchy.org, Open-Meteo, wttr.in outages, saved country codes, and LC_MEASUREMENT). --------- (cherry picked from commit 322523c) Co-authored-by: Reese Royster <reeseroyster@pm.me> Co-authored-by: Mikhail Turov <groldster@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
The weather panel chose Celsius or Fahrenheit from wttr.in's
nearest_areacountry alone, falling back toQt.locale().name(LANG=en_US.UTF-8). Whenever wttr.in returns HTTP 500 (for example during the current outage in chubin/wttr.in#1316) or lags behind Open-Meteo, non-US locations flip to Fahrenheit and mph.This keeps the two-letter ISO 3166-1 country code from
geo.omarchy.org, Open-Meteo geocoding (country_code), andomarchy-weather-location --set <name> [lat,lon] [--country <code>]. The panel resolves units from the location's country first, then wttr.in's country for the active query, thenLC_ALL,LC_MEASUREMENT,LANG, andQt.locale().name.It also recognizes
LR,MM, and non-English US territory locales such ases_US.UTF-8. Cached wttr.inareaInfois scoped to the query that fetched it, so a previous city's country cannot leak across location switches during an outage. If a cancelled wttr.in process exits after a location switch, the replacement fetch is queued rather than dropped.Fixes #17415
Builds on #17443 (Reese Royster) and #20224 (Mikhail Turov), and supersedes #21164 (Andreas Kraxner).
Verification
bash test/shell.d/weather-unit-test.sh: fails onquattrobefore the fix and passes 29/29 after, covering degraded provider combinations and CLI validation.bash test/shell.d/bar-widget-contract-test.shandbash test/shell.d/i18n-test.sh: pass.quattrowith wttr.in returning HTTP 500,geo.omarchy.orgreturning Heemserveen (NL), andLANG=en_US.UTF-8:quattro:52°F, feels49°F,9 mph.NL):11°C, feels9°C,15 km/h.--country au(Sydney):11°C, feels9°C,15 km/h.LC_MEASUREMENT=nl_NL.UTF-8:11°C,15 km/h.systemctl --failedandcoredumpctlclean in the VM.bin/omarchy-weather-statusandbin/omarchy-weather-icon(separate wttr.in dependency, unchanged here).Screenshots
Before (stock
quattro, Heemserveen NL, wttr.in HTTP 500,LANG=en_US.UTF-8):After (patched, Heemserveen NL, wttr.in HTTP 500,
LANG=en_US.UTF-8):