Skip to main content

APRSD Plugin for OpenWeatherMap APIs

Project description

PyPI Status Python Version License

Read the documentation at https://aprsd-openweathermap-plugin.readthedocs.io/ Tests Codecov

pre-commit

Features

This plugin provides two APRSD plugins that use the OpenWeatherMap API:

  • WeatherPlugin - Returns current weather conditions based on GPS beacon location

  • TimePlugin - Returns current time in the timezone of the GPS beacon location

Both plugins use aprs.fi to look up the GPS coordinates of APRS stations, then use OpenWeatherMap to fetch weather and timezone information.

Requirements

  • APRSD server (version 4.2.0 or higher)

  • OpenWeatherMap API key (free tier available)

  • aprs.fi API key (for location lookup)

Installation

You can install APRSD Plugin for OpenWeatherMap APIs via pip from PyPI:

$ pip install aprsd-openweathermap-plugin

Configuration

Getting an OpenWeatherMap API Key

  1. Visit https://home.openweathermap.org/users/sign_up to create a free account

  2. Once logged in, navigate to https://home.openweathermap.org/api_keys

  3. Generate a new API key (or use the default one provided)

  4. The free tier includes 1,000 API calls per day, which is sufficient for most use cases

Note: It may take a few minutes for a newly created API key to become active.

Configuring the Plugin

Add the following to your APRSD configuration file (typically aprsd.conf):

[aprsd_openweathermap_plugin]
enabled = True
apiKey = YOUR_OPENWEATHERMAP_API_KEY_HERE

[aprs_fi]
apiKey = YOUR_APRS_FI_API_KEY_HERE

You can get an aprs.fi API key from https://aprs.fi/account/

Usage

Weather Plugin

The WeatherPlugin provides current weather conditions at the location of an APRS station’s GPS beacon.

Command Format: * w or weather - Get weather at your own location (based on your callsign’s last GPS beacon) * w CALLSIGN or weather CALLSIGN - Get weather at the specified callsign’s location

Example Usage:

Send a message to your APRSD server:

weather

Response:

clear sky 20.5C/15.2C Wind 10@180 65%

Or query weather for a specific station:

weather N0CALL

Response:

partly cloudy 22.0C/18.0C Wind 15@270G25 70%

The response includes: * Weather description (e.g., “clear sky”, “partly cloudy”) * Temperature and dew point in Celsius or Fahrenheit (based on configured units) * Wind speed, direction, and optional gust * Humidity percentage

Time Plugin

The TimePlugin provides the current time in the timezone of an APRS station’s GPS beacon location.

Command Format: * t or time - Get time at your own location * t CALLSIGN or time CALLSIGN - Get time at the specified callsign’s location

Example Usage:

Send a message to your APRSD server:

time

Response:

2024-01-15 14:30:00 PST

Or query time for a specific station:

time N0CALL

Response:

2024-01-15 16:30:00 EST

The plugin automatically determines the timezone based on the GPS coordinates and returns the local time. If OpenWeatherMap API is unavailable, it defaults to UTC time.

How It Works

Both plugins follow a similar workflow:

  1. Extract the callsign from the message (or use the sender’s callsign if not specified)

  2. Query aprs.fi API to get the GPS coordinates (latitude/longitude) of the callsign’s last beacon

  3. Use the GPS coordinates to query OpenWeatherMap API for: * WeatherPlugin: Current weather conditions * TimePlugin: Timezone information

  4. Format and return the results

The plugins require both APIs to be functional: * If aprs.fi lookup fails, the plugin returns “Failed to fetch location” * If OpenWeatherMap API fails, WeatherPlugin returns “Unable to get weather” * If OpenWeatherMap API fails, TimePlugin defaults to UTC timezone

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the MIT license, APRSD Plugin for OpenWeatherMap APIs is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This project was generated from @hemna’s APRSD Plugin Python Cookiecutter template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aprsd_openweathermap_plugin-1.0.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aprsd_openweathermap_plugin-1.0.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file aprsd_openweathermap_plugin-1.0.0.tar.gz.

File metadata

File hashes

Hashes for aprsd_openweathermap_plugin-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e0a09502433e07eb32b69d8577ba7bbba98fe5dcb134f6c820e716773e9dc762
MD5 8ce1b25bca74fde7adc546094226c639
BLAKE2b-256 0880fa11cda53f5eb389dcf4f6d09cd4be89f491e1d4e6aa841f43d4743b72aa

See more details on using hashes here.

File details

Details for the file aprsd_openweathermap_plugin-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aprsd_openweathermap_plugin-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ee7f79db4ad027f03f19dda0573cb187e44a4909077ff528820a2b20b09d4bf
MD5 9d46ab7a779666a8fd666587f7ba0fd9
BLAKE2b-256 12d075af607a106c58522a9bbc7d6c25ff82940dd138a932ecc62bed79314235

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page