A collection of Python scripts for fetching weather data from various sources and sending it via Meshtastic radio network.
This project provides professional weather monitoring scripts with centralized configuration management:
- Environment-based configuration: All settings managed via
.envfile for security and flexibility - Multiple weather data sources: NWS and Tempest Weather Station support
- Meshtastic integration: Seamless transmission to your mesh network
- Current conditions and forecasts: Real-time observations and future predictions
- Automatic message splitting: Messages longer than 210 characters are automatically split into multiple parts with appropriate delays between transmissions
Fetches NWS (National Weather Service) hourly forecast data and sends the next 2 hours via Meshtastic.
Features:
- Gets hourly forecast from NWS API
- Compares forecast times with current time
- Sends next 2 upcoming hours of weather data
- Includes active weather alerts
Note: Messages include a hardcoded location reference ("NE Scottsdale"). You may want to modify line 45 in the script to reflect your actual location.
Fetches current weather conditions from your Tempest Weather Station and sends via Meshtastic.
Features:
- Real-time conditions from Tempest API
- Temperature, humidity, pressure, wind data
- Rainfall and lightning strike counts
- Solar radiation index
- Estimated charge rate for solar panel based on configured panel size in square meters
Note: Messages include a hardcoded location reference ("NE Scottsdale"). You may want to modify line 59 in the script to reflect your actual location.
Fetches current weather observations from the nearest NWS weather station and sends via Meshtastic.
Features:
- Automatically finds nearest NWS station
- Current conditions including temperature, humidity, wind, pressure
- Converts all data to US units
Fetches daily forecast from Tempest Weather Station Better Forecast API and sends via Meshtastic.
Features:
- Daily high/low temperatures
- Precipitation probability
- Wind forecast
- Sunrise/sunset times
Note: Messages include a hardcoded location reference ("NE Scottsdale"). You may want to modify line 96 in the script to reflect your actual location. Also note that this script uses a default CHANNEL_INDEX of 0 instead of 4.
This project uses environment variables for configuration. All settings are managed through a .env file, which keeps your sensitive information (like API tokens) separate from the code.
-
Copy the example environment file:
cp .env.example .env
-
Edit
.envwith your specific configuration values (see below for detailed instructions) -
Install dependencies:
pip install -r requirements.txt
Edit your .env file with the following variables:
MESHTASTIC_INTERFACE- Connection type:tcporserial(default:tcp)MESHTASTIC_HOST- IP address or hostname of your Meshtastic device (required for TCP, default:localhost)MESHTASTIC_PORT- Serial port for your Meshtastic device (required for Serial, e.g.,COM3on Windows or/dev/ttyUSB0on Linux)CHANNEL_INDEX- Meshtastic channel index to send messages to (default:4for most scripts,0fortempest_forecast.py)
LAT- Your location latitude (e.g.,33.74733)LON- Your location longitude (e.g.,-111.77912)USER_AGENT- Contact info for NWS API (e.g.,WeatherApp/1.0 (your.email@example.com))
TEMPEST_STATION_ID- Your Tempest weather station IDTEMPEST_API_TOKEN- Your Tempest API token
PANEL_SIZE- Solar panel size in square meters (default:0.04)PANEL_EFFICIENCY- Panel efficiency as decimal (default:0.20for 20%)
TCP Interface (default):
# Meshtastic Configuration - TCP Interface
MESHTASTIC_INTERFACE=tcp
MESHTASTIC_HOST=192.168.1.100
CHANNEL_INDEX=4
# Location Coordinates (for NWS scripts)
LAT=33.74733
LON=-111.77912
# NWS API Configuration
USER_AGENT=WeatherApp/1.0 (your.email@example.com)
# Tempest Weather Station Configuration
TEMPEST_STATION_ID=12345
TEMPEST_API_TOKEN=your-api-token-here
# Solar Panel Configuration (for getwx.py)
PANEL_SIZE=0.04
PANEL_EFFICIENCY=0.20Serial Interface:
# Meshtastic Configuration - Serial Interface
MESHTASTIC_INTERFACE=serial
MESHTASTIC_PORT=COM3 # Windows example (use /dev/ttyUSB0 on Linux)
CHANNEL_INDEX=4
# Location Coordinates (for NWS scripts)
LAT=33.74733
LON=-111.77912
# NWS API Configuration
USER_AGENT=WeatherApp/1.0 (your.email@example.com)
# Tempest Weather Station Configuration
TEMPEST_STATION_ID=12345
TEMPEST_API_TOKEN=your-api-token-here
# Solar Panel Configuration (for getwx.py)
PANEL_SIZE=0.04
PANEL_EFFICIENCY=0.20The Tempest scripts (getwx.py and tempest_forecast.py) require a Tempest Weather Station and API token.
Your Station ID can be found in your Tempest account at tempestwx.com:
- Log in to your Tempest account
- Click on your station name in the left sidebar
- Click the gear icon (⚙️) or "Settings" for your station
- Your Station ID will be displayed in the station information section
To generate an API token:
- Go to tempestwx.com/settings/tokens
- Log in with your Tempest account credentials
- Click "Create Token"
- Give your token a descriptive name (e.g., "Meshtastic Weather")
- Copy the generated token and add it to your
.envfile'sTEMPEST_API_TOKENvariable
For more information about the Tempest/WeatherFlow API, refer to the official documentation:
Python Version: Python 3.7 or higher is required.
Dependencies:
requests>=2.31.0
meshtastic>=2.2.0
python-dotenv>=1.0.0
Install all dependencies:
pip install -r requirements.txt-
Ensure your
.envfile is properly configured (see Configuration section above) -
Run any script directly:
python getwx_forecast.py
python getwx.py
python nws_current_weather.py
python tempest_forecast.pyNote: Each script will validate that required environment variables are set before running.
Some scripts include hardcoded location references in their output messages (e.g., "NE Scottsdale"). To customize these for your location:
- getwx.py: Edit line 59 to change the location name in the weather message
- getwx_forecast.py: Edit line 45 to change the location name in the forecast message
- tempest_forecast.py: Edit line 96 to change the location name in the forecast message
The nws_current_weather.py script automatically uses the station name from the NWS API and does not require customization.
- Never commit your
.envfile to version control (it's already in.gitignore) - Keep your API tokens and credentials secure
- Use the
.env.examplefile as a template for new installations - Regularly rotate your API tokens
- Consider using restrictive file permissions on your
.envfile:chmod 600 .env
These scripts support both TCP and Serial interfaces for connecting to your Meshtastic device.
Connect to a Meshtastic device over the network (WiFi or Ethernet):
- Set
MESHTASTIC_INTERFACE=tcpin your.envfile - Set
MESHTASTIC_HOSTto the IP address or hostname of your device - Make sure your Meshtastic device has network connectivity enabled
Connect to a Meshtastic device via USB serial port:
- Set
MESHTASTIC_INTERFACE=serialin your.envfile - Set
MESHTASTIC_PORTto your serial port:- Windows:
COM3,COM4, etc. (check Device Manager) - Linux:
/dev/ttyUSB0,/dev/ttyACM0, etc. - macOS:
/dev/tty.usbserial-*or/dev/tty.SLAB_USBtoUART
- Windows:
- Make sure your Meshtastic device is connected via USB
Windows:
Get-PnpDevice -Class Ports -Status OK | Select-Object Name, FriendlyNameLinux/macOS:
ls /dev/tty*
# or
dmesg | grep ttyMIT License