By Joe (KD2NFC)
Assisted by ChatGPT — with respect to the original work by KD5FMU and contributors.
Overview
If your AllStar or Skywarn node stopped announcing the weather, it’s because the original script depended on the AccuWeather RSS feed, which is now gone (HTTP 410 – page removed).
This update replaces that broken feed and brings the script into 2025 with two working weather providers:
-
NOAA METAR (aviationweather.gov / forecast.weather.gov)
-
Open-Meteo (free global API, no key needed)
You can choose either provider in your configuration file — no more editing the script to switch sources.
What’s New
Fixed: Removed dead AccuWeather feed
Added: Open-Meteo API support (works worldwide, ZIP or ICAO)
Added: NOAA METAR API fallback (U.S. airports only, ICAO only)
Added: Day/night logic (no more “sunny” at midnight
)
Configurable via weather.ini
Keeps compatibility with your existing Asterisk .gsm voice files
Installation
-
Backup your old file:
sudo cp /usr/local/sbin/weather.sh /usr/local/sbin/weather.sh.bak -
Drop in the new
weather.sh
(Download from the link or attachment provided with this post.)sudo cp weather.sh /usr/local/sbin/weather.sh sudo chmod +x /usr/local/sbin/weather.sh -
Update your configuration file:
sudo nano /etc/asterisk/local/weather.iniExample:
process_condition="YES" Temperature_mode="F" DEFAULT_PROVIDER="openmeteo"-
process_condition: YES = include condition (e.g., “cloudy”), NO = just temperature -
Temperature_mode: “F” or “C” -
DEFAULT_PROVIDER: “openmeteo” or “metar”
-
Usage Examples
| Command | Description | Works with |
|---|---|---|
bash /usr/local/sbin/weather.sh KEWR v |
Fetch weather using METAR (ICAO airport code only) | METAR |
bash /usr/local/sbin/weather.sh 10314/EWR v |
Fetch weather using Open-Meteo (ZIP or city or ICAO) | Open-Meteo |
sudo perl /usr/local/sbin/saytime.pl KEWR 46596 |
Run your Time-and-Weather voice announcement | Both |
v= “view only” mode (prints results to screen without voice output)
Output Example
METAR:
Running Joe KD2NFC version of weather.sh (provider: metar)
58°F, 14°C / cloudy
Open-Meteo:
Running Joe KD2NFC version of weather.sh (provider: openmeteo)
59°F, 15°C / clear
Condition Mapping
The script uses a simple set of condition words compatible with Asterisk sound files:
clear, sunny, cloudy, rain, snow, hail, fog, mist, thunderstorm
It will automatically locate .gsm files in:
/var/lib/asterisk/sounds/
/usr/local/share/asterisk/sounds/custom/
Optional Logging (for troubleshooting)
You can add this near the bottom of the script to keep a simple log:
echo "$(date '+%F %T') ${provider}: ${temp_f}°F / ${cond}" >> /var/log/weather.log
Notes
-
METAR requires a valid ICAO code (e.g.,
KEWR,KJFK,KLAX)
→ It won’t work with ZIP codes. -
Open-Meteo accepts both ZIP codes and ICAO codes.
-
The script automatically falls back between providers if one fails.
Credits
-
Original concept: KD5FMU and contributors
-
Modernized and maintained by: Joe (KD2NFC)
-
With assistance from: ChatGPT (OpenAI)