A weather plugin for Limnoria. It supports multiple weather and geocoding backends:
- OpenWeatherMap (default, API key required)
- WWIS (no API key required, major cities only)
- weatherstack (current conditions only, API key required)
- Pirate Weather (API key required)
- OpenStreetMap Nominatim (default, no API key required)
- Google Maps (API key required)
- OpenCage (API key required)
- aqicn.org (API key required)
Due to technical limitations, installation via Limnoria's PluginDownloader or pip is currently unavailable.
Clone the Git repository somewhere and add the parent directory to your bot's config directories.plugins
setting.
Make sure the directory that you save the plugin to matches the plugin name:
$ git clone https://github.com/jlu5/Limnoria-NuWeather NuWeather
After cloning, you can update your copy of the plugin in place by entering the NuWeather directory and running:
$ git pull
-
Pick your preferred weather backend:
config help plugins.NuWeather.defaultBackend
-
Grab an API key. OpenWeatherMap | weatherstack | Pirate Weather
- WWIS is another option that requires no API key, but is limited (in most countries) to major cities only
- Note that for OpenWeatherMap this plugin uses the "Professional collections" APIs, not the OneCall 3.0 API!
-
Configure it:
/msg yourbot config plugins.NuWeather.apikeys.BACKENDNAME YOUR-API-KEY
-
Set your default weather location:
setweather <your-preferred-location>
-
Obtain weather:
weather [<optional location>]
This plugin includes a script to migrate from the Weather plugin's SQLite DB to NuWeather's binary format.
$ ./weather-migrate.py -h
usage: weather-migrate [-h] infile outfile
Migrates user locations from the Weather plugin to NuWeather.
positional arguments:
infile input filename (BOT_DATA_DIR/Weather.db)
outfile output filename (e.g. BOT_DATA_DIR/NuWeather.db)
optional arguments:
-h, --help show this help message and exit
-
If you have not loaded NuWeather previously, load the plugin for the first time so that config entries are populated.
-
Then, unload the plugin before running the migration script. You may also wish to make a backup of your current
NuWeather.db
if it is of any use. -
Run the script on the right files:
./weather-migrate.py BOT_DATA_DIR/Weather.db BOT_DATA_DIR/NuWeather.db
-
After performing the migration, set the
plugins.NuWeather.DBAddressingMode
option tonicks
(since the previous database tracks locations by nick):
config plugins.NuWeather.DBAddressingMode nicks
- Load the plugin again for these changes to take effect.
(If you're comfortable with re-creating your database from scratch, the other options tell NuWeather to save location by Limnoria account (the default) or ident@host.)
- weatherstack provides weather lookup by place name directly, and does not need further configuration.
- OpenStreetMap, WWIS, and Pirate Weather backends use a separate service to translate place names into GPS coordinates, a process known as geocoding.
The default geocoding backend is OpenStreetMap's Nominatim; this can be configured via the plugins.NuWeather.geocodeBackend
option.
Other options include Google Maps and OpenCage. These may provide more relevant results for North America (e.g. US ZIP codes), but both require API keys:
- Google Maps (requires credit card billing) | OpenCage
API keys for geocoding backends are similarly configured as plugins.NuWeather.apikeys.BACKENDNAME
.