-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
enhancementNew feature or requestNew feature or requestscope-controlFeature-scope and roadmap managementFeature-scope and roadmap management
Description
Summary
Add an "Auto (based on location)" option to the temperature/unit preference setting that automatically selects the appropriate unit system based on the location's country.
Current Behavior
Users manually choose between Fahrenheit, Celsius, or "both" for temperature display. Wind, visibility, and precipitation units are tied to this choice.
Proposed Behavior
Add a new "Auto" option that detects the location's country and applies the culturally standard unit system:
| Region | Temp | Wind | Visibility | Precipitation | Pressure |
|---|---|---|---|---|---|
| US | °F | mph | miles | inches | inHg |
| UK | °C | mph | miles | mm | mb |
| Canada | °C | km/h | km | mm | mb |
| Everywhere else | °C | m/s | km | mm | hPa |
Why These Combos?
- UK is uniquely metric-for-temperature but imperial-for-speed/distance
- Canada uses metric but km/h instead of m/s for wind
- US is fully imperial for weather
- Most other countries follow SI
Implementation Notes
Country Detection
- Could use reverse geocoding from the location coordinates
- Open-Meteo geocoding API already returns country codes
- NWS locations are always US
- Cache the country code per location to avoid repeated lookups
Unit System Mapping
- Map country codes to unit systems (US→us, GB→uk, CA→ca, default→si)
- Pirate Weather already supports these exact 4 unit systems natively
- Other providers would use the existing conversion logic
Settings
- Add "Auto (based on location)" as a new option in the temperature unit dropdown
- When selected, unit preference changes dynamically per location
- Per-location override could be a future enhancement
Display Layer
- The display/presentation layer already handles unit conversion
- Would need to resolve the effective unit preference per-location before formatting
- "both" display mode should still work as a separate option
References
- Current unit handling:
src/accessiweather/display/presentation/formatters.py - PW unit parameter:
src/accessiweather/pirate_weather_client.py(supports us/si/ca/uk) - Temperature unit enum:
src/accessiweather/models/weather.py
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestscope-controlFeature-scope and roadmap managementFeature-scope and roadmap management