FediMeteo, timezones, and the art of not breaking what already works
2 days ago
- FediMeteo began as a simple Python script for Italian cities, using Nominatim for coordinates, Open-Meteo for weather, and snac for posting.
- It expanded to multiple European countries by separating localization into JSON files and using cron schedules per country.
- Adding Germany revealed name ambiguity issues (e.g., multiple Neustadt, Frankfurt am Main vs. an der Oder), leading to manual workarounds.
- The United States brought major challenges: 1200+ cities, six timezones, and widespread name duplicates (e.g., Springfields, Portlands).
- The bot was rewritten to support state suffixes, automatic timezone detection, multiple weather providers with fallback, configurable units, and strict backward compatibility.
- A debug print accidentally leaked the Open-Meteo API key into posts; the incident prompted multi-layer secret redaction.
- A coordinate cache was introduced to reduce Nominatim load and allow manual fixes (e.g., correcting Ferrara’s coordinates from province centroid to city center).
- The slow cycle (due to sleep between cities) and cron-based scheduling caused missed updates on reboots; a daemon with state file resume was implemented for robustness.
- The design philosophy emphasizes Unix-style simplicity, hidden complexity, and operational resilience without breaking existing functionality.