rich e961f6c402 Remove the station coordinates and deploy host from the repository
Examples use a generic Philadelphia location. deploy.sh now requires
DEPLOY_HOST and defaults DEPLOY_DIR to the remote user's home.
2026-11-09 08:06:43 -05:00
2026-06-30 19:10:44 -04:00

Tropospheric Ducting

Watches the atmosphere over the Philadelphia area for tropospheric ducting -- the layers that bend 900 MHz signals past the horizon -- and says how far radios are likely to reach: a public status page, a seven-day outlook, a history, and a morning digest.

Its data is also available through a read-only JSON API.

Piece Runs as Does
tropo_collect.py cron, every 20 min Scores current conditions from Open-Meteo into InfluxDB
tropo_forecast.py cron, twice a day Scores the seven-day forecast into InfluxDB
tropo_alert_v2.py cron, mornings Builds the daily digest, and transmits it when MESH_ALERTS_ENABLED is true
tropo_status.py tropo-status (gunicorn, :5001) The public pages and their JSON API
cleanup_node_data.py by hand Drops the node-tracking measurements and tables from InfluxDB and SQLite (not needed on a new install)
tropo_widget.js Scriptable (iOS) Home-screen widget reading the JSON API; see Scriptable widget

Scripts

1. Tropospheric Ducting Alerts (tropo_alert_v2.py)

Builds a morning forecast digest for the mesh from the recorded ducting scores; sending over Meshtastic is controlled by MESH_ALERTS_ENABLED. Tuned for 900 MHz (Meshtastic's frequency), which is trapped by thinner and weaker inversions than VHF/UHF.

Reads ducting_score, regional_max_score, best_direction, and elevated_directions from InfluxDB. It holds no state between runs: every message is built from the recorded score and forecast series.

The opening announcement ("TROPO OPENING") is built from the current scores, carrying an estimated duration and peak strength drawn from the forecast, plus a link to the status page. Only --test builds it, and it does so whatever the score; the cron sends only the daily digest.

The duration estimate comes from the ducting_forecast series written by tropo_forecast.py: it walks the forecast forward from now until it has stayed below RESET_THRESHOLD for RESET_HOLD_HOURS. If the forecast is missing, or disagrees with the live score badly enough that it already reads below the reset threshold, the estimate line is simply left out rather than broadcasting a confident wrong number. Look-ahead defaults to 72 hours and is settable with FORECAST_OUTLOOK_HOURS.

Daily forecast digest. --daily-forecast sends a one-message summary of the next 24 hours. It is written for a mesh that is not all radio people: it leads with a plain magnitude rather than the 0-10 score, names what the effect actually is, and lists the best window with the direction it favours.

The score is deliberately left out. Thresholds here are tuned low for 900 MHz, so a peak of 2.5 is a genuine opening — but a newcomer reading "2.5/10" would reasonably conclude nothing was happening. Range boost is pinned to the thresholds the alerter acts on instead: below the watch threshold is NONE, up to START_THRESHOLD is SMALL, up to twice that is GOOD, and beyond is STRONG.

Days often have more than one window, and a morning lift and an evening duct frequently favour different directions — so each window carries its own bearing. The strongest is listed first, then the next, with any others as a count.

Because the digest goes out in the morning and covers a rolling 24 hours, windows routinely land after midnight. Any time falling on a later date is day-stamped (Sun 02:00-05:00, or 19:00-Sun 01:00 for one that crosses midnight) so a bare time can never read as having already passed.

Staying inside one packet is the point of the digest, so if the varying parts — day stamps, direction names, the spillover count — would push it past 200 characters, the second window is folded back into the count rather than paying for a second transmission.

It reads only the forecast series, and stays silent when there is no forecast to report. Intended for a morning cron; the line is under Installation.

No digest is sent when the 24h peak is below DAILY_FORECAST_MIN_SCORE. The example config sets it to 2.0, the same as the watch threshold, so quiet days send nothing. Set it below the watch threshold (or to 0) to get a short Range boost: NONE message on those days instead.

Features:

  • Reads pre-computed scores from InfluxDB — no duplicate API calls
  • Waits for ACK from the Meshtastic node before considering the send complete
  • Stateless: nothing is persisted between runs, so a missed cron leaves nothing stuck
  • Forecast-based duration and peak-strength estimate in the opening announcement
  • Daily 24-hour forecast digest (--daily-forecast) for a morning cron

Usage:

python3 tropo_alert_v2.py --status    # Show current scores and thresholds
python3 tropo_alert_v2.py --test      # Force-send a START alert using current scores
python3 tropo_alert_v2.py --daily-forecast  # Send the 24-hour forecast digest

To stop transmitting, set MESH_ALERTS_ENABLED = False. Messages are still built and logged, which is the useful thing to look at when tuning thresholds.


2. Tropospheric Ducting Status Page (tropo_status.py)

A Flask-based public-facing web dashboard that displays live tropospheric ducting conditions for the region. Reads the InfluxDB data written by tropo_collect.py, plus the Open-Meteo availability flag in the shared SQLite database.

Everything on the page is derived from atmospheric modeling. The page reports what the atmosphere is shaped to do — it is a forecast of propagation, not a measurement of it.

Features:

  • Auto-refreshes every 5 minutes; mobile-optimized layout
  • All charts show a rolling 24 hours
  • Warns when Open-Meteo has been unreachable long enough that scores are stale
  • Links to the 7-Day Tropospheric Outlook page (/forecast, fed by tropo_forecast.py) and to the History page (/history)

Page sections:

  • Current Conditions — score badge with label and strongest direction, plus three stat tiles: Local Score, Regional Max Score, and Sharpest Gradient — the lowest dM/dz across every sampled layer at every location, with its altitude band, where it is, and whether it is a duct. Standard atmosphere is ~118 M-units/km; a trapping layer is dM/dz <= 0, so a value in between means enhanced refraction but no duct, and the tile labels it that way
  • Score History — 24h line chart of local and regional scores
  • Score by Direction — Radar — polar chart with Current / Peak toggle
  • Score by Direction — Heatmap — time × direction heatmap showing score evolution
  • Score Reference — score band legend
  • Atmospheric Layers — M-Gradient Over Time — dM/dz per altitude band for a selectable sample location
  • Atmospheric Profile — Regional Comparison — M-unit vertical profiles for every relevant sample location, with a slider to scrub the last 24 hours

History page (/history):

What the conditions actually were, for any past day, week or calendar month — the recorded counterpart to the outlook. Modelled on a weather site's history page: pick a date, step through it with the arrows (or the left and right keys), and share the result as a URL — the view is held in ?d=YYYY-MM-DD&p=day|week|month.

  • Summary tiles — peak score and when it happened, hours at or above the alert threshold, hours with a trapping layer, and which direction the openings favoured
  • Daily summary — one row per day: peak, mean and floor of the regional score, the QTH's own peak, the hour and direction of the peak, and hour counts for the alert threshold, ducting and super-refraction. Any row opens that day
  • Hour by hour — in the single-day view the daily table is replaced by one row per hour, each carrying the sharpest gradient recorded and whether it was a duct
  • Recorded score — regional and QTH traces over the span, with the alert and reset thresholds marked
  • Score by direction — the directional heatmap over the same span

Day boundaries are resolved in the reader's own timezone, not UTC, so a day holds the hours they would call that day — across a DST change included. Chart resolution follows the span: 15-minute buckets for a day, hourly for a week, three-hourly for a month. A request longer than 92 days is refused.

How far back the page can go is whatever InfluxDB still holds. Nothing here prunes it, so with the default autogen retention policy the floor is the first run of tropo_collect.py; set a retention policy on the database and the floor moves with it. The date picker is bounded by what the data actually covers.

The data behind these pages is available from the JSON API.

Usage:

python3 tropo_status.py               # Start server (default: 0.0.0.0:5001)
python3 tropo_status.py --port 8080   # Custom port

For production, run under gunicorn:

gunicorn -w 2 -b 0.0.0.0:5001 tropo_status:app

Or install it as a systemd unit. The installer uses the checkout's .venv/bin/gunicorn and the port from STATUS_PORT in tropo_config.py (else 5001), and runs the service as the user who invoked sudo. Override any of them when needed:

sudo ./install_service.sh
sudo ./install_service.sh --gunicorn /opt/venv/bin/gunicorn --port 5005 --user tropo
sudo systemctl restart tropo-status

The unit always binds to 0.0.0.0; STATUS_HOST only applies when running tropo_status.py directly.

Behind a reverse proxy

To serve the pages under a prefix, set STATUS_SUBPATH (e.g. "/tropo") so the pages call the API at the right address, and have the proxy strip that prefix, because the routes themselves have none. With nginx:

location /tropo/ {
    proxy_pass http://127.0.0.1:5001/;
}

Scriptable widget

tropo_widget.js is a home-screen widget for the iOS Scriptable app, and is not served by this project. Set BASE_URL at the top of the file to your status page's public address, paste it into a new Scriptable script, and add a Scriptable widget that runs it.

Themes

Each page has a theme picker in its header: Auto, Dark, Light, and high-contrast versions of both. The choice is stored per browser and shared across the pages.

High contrast uses the palette MeshMonitor uses for its own — pure black or white ground, full-strength text, and borders light enough to find. The score colours change with it: the usual Grafana hues are mid-tone and lose their separation against pure black or pure white, so the high-contrast themes substitute MeshMonitor's chart colours.

The shared mechanism lives in templates/_theme.html and is substituted into each page's head; the palettes themselves are per page. Anything that reads a colour in JavaScript — Plotly, Chart.js — goes through isLightTheme() / isHighContrast() and redraws on onThemeChange(), so switching applies without a reload.

Page templates

The pages live in templates/ — status.html, forecast.html and history.html — and are read on demand, cached against their modification times so an edited page is picked up on the next request without a restart. They are plain files, not Jinja templates: each carries its own __SUBPATH__ placeholder which the route substitutes, and handing this much JavaScript to a template engine would only invite it to misread a brace.


3. Seven-Day Tropospheric Forecast (tropo_forecast.py)

Scores forecast atmospheric soundings the same way tropo_collect.py scores current ones, producing a 7-day outlook for ducting and super-refraction. Writes to InfluxDB for the /forecast page served by tropo_status.py.

The scoring functions are imported from tropo_collect.py rather than reimplemented, so a forecast score means exactly what a live score means.

What it collects:

  • One batch Open-Meteo request covering the QTH plus the same 8 compass directions × REGIONAL_SAMPLING_DISTANCES_MILES that tropo_collect.py samples (17 locations)
  • Every forecast hour scored per ITU-R P.453-14, classified as ducting (dM/dz <= 0, a trapping layer), super-refraction (0 < dM/dz <= 78), or normal
  • Written to the ducting_forecast measurement, timestamped at the hour each point is valid for, so a later run refreshes the hours it overlaps and the freshest forecast always wins

Model: Open-Meteo's best_match, which over the continental US serves HRRR for roughly the first 48 hours — the same model tropo_collect.py uses live — and GFS beyond that. GFS is coarser and smooths away the shallow nocturnal ducts HRRR resolves, so scores past that seam read systematically low (measured at mean −0.13, up to −1.0, over a 48h overlap). Every point stores lead_hours so the page can shade the low-confidence portion of the week. Note that ECMWF is not usable here: it publishes only three of the seven pressure levels this scoring needs.

Usage:

python3 tropo_forecast.py               # Fetch, score, write to InfluxDB
python3 tropo_forecast.py --dry-run     # Fetch and score, print a summary
python3 tropo_forecast.py --days 3      # Shorter horizon

--days defaults to 8: Open-Meteo returns whole days from midnight, so a run late in the day needs the extra one to reach a full 7 days ahead.

Designed to run via cron twice a day; the line is under Installation.

API cost: one batch request per run. Open-Meteo's fractional multiplier keys off the number of variables (16 → 1.6 calls per location), and its time-range threshold is two weeks, so a 7-day request costs the same as a 1-day one — the extra days are free. At 17 locations that is ~27 calls per run, or ~54/day at twice daily: roughly 0.5% of the 10,000/day free-tier limit, on top of the ~1,958/day the 20-minute tropo_collect.py cron uses at the conservative counting assumption.


4. Tropospheric Conditions Collector (tropo_collect.py)

Samples Open-Meteo for the QTH and the surrounding region, scores every sounding per ITU-R P.453-14, and writes the result to InfluxDB 1.x for tropo_status.py and Grafana. It is the only writer of live ducting data.

Usage:

python3 tropo_collect.py           # Normal run
python3 tropo_collect.py --dry-run # Print values without writing to InfluxDB

Designed to run via cron every 20 minutes; the line is under Installation.

Tropospheric Ducting Score (written to mesh_conditions)

Computes a ducting score (0–10) using M-unit gradients per ITU-R P.453-14 from Open-Meteo atmospheric profile data (HRRR model, updated hourly).

Score Label Meaning
0.0 – 0.9 Negligible Standard propagation only
1.0 – 2.9 Weak Mild super-refraction; slight range extension possible
3.0 – 4.9 Moderate Ducting layer detected; some path enhancement likely
5.0 – 6.9 Strong Well-developed duct; good conditions for extended paths
7.0 – 10.0 Excellent Exceptional ducting; significant range extension expected

Four fields are written per run: ducting_score (the QTH), regional_max_score, best_direction, elevated_directions.

Regional Ducting Sampling (written to ducting_regional)

Samples Open-Meteo at 8 compass directions (N, NE, E, SE, S, SW, W, NW) at two configurable distances (default 50 and 75 miles) around your QTH — 16 points total — to detect favorable ducting conditions in nearby areas even when your local score is low. All points are fetched in one batch request.

Each point is written to the ducting_regional measurement with:

  • Tags: direction, distance_miles
  • Fields: ducting_score, latitude, longitude

The highest score across all regional points is written back to mesh_conditions as regional_max_score, with its compass direction stored as best_direction. Every direction where at least one sample point meets or exceeds ELEVATED_SCORE_THRESHOLD is recorded as a comma-separated string in elevated_directions (e.g. "NE,SW,S", sorted by score descending).

Configure distances in tropo_config.py:

REGIONAL_SAMPLING_DISTANCES_MILES = [50, 75]  # set to [] to disable
ELEVATED_SCORE_THRESHOLD          = 1.5

Atmospheric Profiles and Layers (ducting_profile, ducting_layers)

For every sampled location, the full vertical profile is written as well as the score:

Measurement Tags Fields
ducting_profile direction, distance_miles, pressure_level M_value, altitude_m, temp_c, dewpoint_c, rh_pct, latitude, longitude
ducting_layers direction, distance_miles, layer dM_dz, layer_score, gradient_class, gradient_score, alt_weight, z_lo_m, z_hi_m, is_best_layer, latitude, longitude
ducting_forecast direction, distance_miles, model ducting_score, condition, lead_hours, run_epoch, and when present min_dM_dz, best_dM_dz, layer_base_m, layer_top_m

These feed the M-gradient heatmap and the regional profile comparison on the status page. gradient_class is the ITU-R banding: ducting (dM/dz <= 0, a trapping layer), super (0 < dM/dz <= 78), or normal.

InfluxDB Measurements Summary

Measurement Written by Description
mesh_conditions tropo_collect.py Local and regional ducting scores, best/elevated directions, one point per run
ducting_regional tropo_collect.py Ducting score at each compass-direction sample point
ducting_profile tropo_collect.py Atmospheric M-unit vertical profile at QTH and regional locations
ducting_layers tropo_collect.py Per-altitude-band gradient and layer score for each location
ducting_forecast tropo_forecast.py 7-day forecast score per direction, timestamped at the hour it is valid for

Grafana Dashboard

Import grafana_meshtastic_ducting_dashboard.json for a pre-built ducting conditions dashboard:

  • Local Effect on Signal Propagation — plain-language stat panel for the current score
  • Ducting Score Reference — the score band table
  • Ducting Score by Direction — Radar — polar plot of all 8 bearings
  • Local vs Regional Max Ducting Score — spot nearby ducting even when your local score is low
  • Ducting Score by Direction — Heatmap — every direction's score over time

JSON API

tropo_status.py serves a read-only API. Every endpoint takes GET, needs no authentication and returns JSON, under the same address as the pages (including any reverse-proxy prefix).

Times are UTC ISO 8601 strings unless a field is named epoch, or described below as Unix seconds. Scores are 0-10. Failures return {"error": "<message>"} with status 500, or 400 for a bad /api/history_range request; /api/status returns 503 when there is no data yet.

Endpoint Parameters Returns
/api/status none Latest conditions
/api/history none Local and regional scores, last 24h
/api/heatmap none Score by direction over time, last 24h
/api/directions mode Score per compass direction
/api/atmo_heatmap direction, distance_miles, since, until dM/dz per altitude band over time
/api/atmo_profiles since, until, timeseries M-unit vertical profiles
/api/forecast hours Forecast by direction, with favourable windows
/api/range_outlook hours Forecast summarised as a range boost and windows
/api/history_extent none Oldest and newest recorded samples
/api/history_range start, end, tz Recorded conditions for a date range

/api/status

{
  "local_score": 1.2,
  "regional_score": 4.8,
  "display_score": 4.8,
  "label": "Moderate",
  "color": "#...",
  "best_direction": "NE",
  "elevated_directions": ["NE", "SW"],
  "sharpest_gradient": {
    "dM_dz": -12.4,
    "layer": "300-500m",
    "gradient_class": "ducting",
    "direction": "NE",
    "distance_miles": "50"
  },
  "timestamp": "2026-05-21T14:00:00Z",
  "api_warning": null
}

display_score is the regional score, or the local one when there is no regional data, in which case regional_score is null. sharpest_gradient can be null. api_warning is a message when Open-Meteo has been unreachable long enough for scores to be stale. gradient_class here and condition in the forecast are ducting, super or normal.

/api/history

{times, local_scores, regional_scores}: parallel arrays at 30-minute intervals.

/api/heatmap

{times, y, z}: y lists the compass directions, and z[i][j] is the score for y[i] at times[j], at 30-minute intervals.

/api/directions

mode is current (default; latest score in the last 3 hours) or peak (highest in the last 24 hours). Returns {directions, scores, colors} as parallel arrays.

/api/atmo_heatmap

Parameter Default Meaning
direction QTH QTH or a compass direction
distance_miles 0 0, or one of REGIONAL_SAMPLING_DISTANCES_MILES
since, until last 24h Unix seconds; until defaults to now

An unrecognised direction or distance_miles falls back to the default. Returns {times, layers, z}, where z[i][j] is dM/dz for layers[i] at times[j]. Intervals are 30 minutes by default and 15 minutes when since is given.

/api/atmo_profiles

since and until are Unix seconds; without both, it uses the last 2 hours.

By default it returns the latest profile per location: {profiles: [{label, direction, distance_miles, altitudes, M_values, score}]}.

With timeseries=1 and both times, it returns one frame per interval (10 minutes to 1 hour, depending on the span), for the QTH and any location reaching ELEVATED_SCORE_THRESHOLD: {times, locations: [{key, label, direction, distance_miles}], frames: [{time, profiles: {<key>: {altitudes, M_values, score}}}]}.

/api/forecast

hours is how far ahead to read: default 168, maximum 384. Returns parallel hourly arrays:

Field Meaning
times, y, z Score by direction over time, as in /api/heatmap
qth Score at the QTH
best_score, best_dir Strongest score each hour, and its direction
condition Gradient class each hour
lead_hours Hours between the forecast run and that hour
night Whether the sun is below the QTH's horizon

Also windows ([{start, end, hours, peak, peak_time, direction, ducting}]), run_epoch (Unix seconds), model, alert_threshold and watch_threshold.

/api/range_outlook

hours is the window to summarise: default 24, from 1 to 168.

{
  "hours": 24,
  "rows": [{"epoch": 1779372000.0, "score": 2.6, "direction": "SE", "condition": "ducting", "grad": -3.1}],
  "boost": "GOOD",
  "windows": [{"start": 1779372000.0, "end": 1779393600.0, "hours": 6, "peak": 4.4,
               "direction": "SE", "ducting": true}],
  "ducting": true,
  "info_url": "https://example.com/tropo"
}

boost is NONE, SMALL, GOOD or STRONG, and windows lists the strongest first. start and end are Unix seconds. With no forecast available, rows is empty and boost is null.

/api/history_extent

{first, last, max_days}: the oldest and newest samples (null with no data), and the longest span /api/history_range accepts.

/api/history_range

Parameter Default Meaning
start, end required Local dates, YYYY-MM-DD, both inclusive; at most 92 days
tz UTC IANA zone the dates are in; an unknown name is treated as UTC
Field Meaning
start, end, timezone The range as resolved
bucket_min Chart interval in minutes: 15 up to 2 days, 60 up to 9 days, otherwise 180
threshold, reset START_THRESHOLD and RESET_THRESHOLD
days One row per day: date, peak, peak_time, peak_dir, avg, low, local_peak, min_grad, open_hours, duct_hours, super_hours, samples
hours For spans up to 2 days, one row per hour: time, peak, peak_dir, avg, low, local_peak, grad; otherwise null
series times, local_scores, regional_scores, regional_peaks as parallel arrays
directions {times, y, z}, as in /api/heatmap

Requirements

  • Python 3.11+
  • InfluxDB 1.x, on this machine or reachable from it
  • Linux with systemd and cron, for the service and scheduled jobs, and sudo access
  • git, curl and Python's venv module
  • A QTH in the continental US: the live collector asks Open-Meteo for the HRRR model, which covers nowhere else
  • Python packages from requirements.lock (Flask, gunicorn, influxdb, requests). meshtastic is separate, and needed only to transmit the digest

Installation

Install the system packages and get a checkout, as the user the service and cron jobs will run as. The package names are for Debian:

sudo apt install git curl cron python3-venv
git clone https://git.rickelobe.com/rich/tropo-ducting tropo-ducting
cd tropo-ducting

Run the remaining steps from the checkout.

1. Python environment

python3 -m venv .venv
.venv/bin/pip install -r requirements.lock

2. InfluxDB. Install InfluxDB 1.x and create the database; nothing here creates it. The name must match INFLUX_DATABASE. On Debian:

sudo apt install influxdb influxdb-client
sudo systemctl enable --now influxdb
influx -execute 'CREATE DATABASE meshtastic'

3. Configuration

cp tropo_config.py.example tropo_config.py

Set LATITUDE, LONGITUDE and TROPO_INFO_URL, plus the InfluxDB connection if it isn't local and unauthenticated. The other settings are described under Configuration.

4. Mesh transmission. MESH_ALERTS_ENABLED is True in the example config, and the digest exits with an error if meshtastic is missing. Either install it and set MESH_HOST:

.venv/bin/pip install 'meshtastic>=2.2'

or set MESH_ALERTS_ENABLED = False to build and log the digest without sending it.

5. State and log locations. The default DB_FILE directory has to exist, and cron can't create files in /var/log as a normal user:

sudo install -d -o "$USER" /var/lib/tropo
sudo touch /var/log/tropo_collect.log /var/log/tropo_forecast.log /var/log/tropo_alert_v2.log
sudo chown "$USER" /var/log/tropo_collect.log /var/log/tropo_forecast.log /var/log/tropo_alert_v2.log

6. Check the collector, then let it write once

.venv/bin/python tropo_collect.py --dry-run
.venv/bin/python tropo_collect.py
.venv/bin/python tropo_forecast.py

7. Start the status page

sudo ./install_service.sh
sudo systemctl restart tropo-status
curl -s http://localhost:5001/api/status | head -c 300; echo

8. Schedule the jobs with crontab -e, setting DIR to this checkout:

DIR=/path/to/tropo-ducting
*/20 * * * *  $DIR/.venv/bin/python $DIR/tropo_collect.py >> /var/log/tropo_collect.log 2>&1
17 5,17 * * * $DIR/.venv/bin/python $DIR/tropo_forecast.py >> /var/log/tropo_forecast.log 2>&1
0 7 * * *     cd $DIR && $DIR/.venv/bin/python tropo_alert_v2.py --daily-forecast >> /var/log/tropo_alert_v2.log 2>&1

Development

.venv/bin/pip install pytest ruff
git config core.hooksPath .githooks      # runs ruff and pytest before every push
.venv/bin/pytest                         # the tests, on the example config, never InfluxDB
.venv/bin/ruff check .

DEPLOY_HOST=user@server ./deploy.sh (from a clean, pushed main) pulls on the server, compiles what changed under its Python and restarts tropo-status when the page changed. The cron scripts pick up changes on their next run. DEPLOY_DIR sets the checkout on the server, by default tropo-ducting in the remote user's home directory. --check says what would restart without changing anything. It does not install dependencies, so run .venv/bin/pip install -r requirements.lock on the server when those change.

Configuration

All settings for tropo_collect.py, tropo_forecast.py, tropo_alert_v2.py and tropo_status.py live in a single file, which each of them imports directly:

cp tropo_config.py.example tropo_config.py
# Edit tropo_config.py with your values

Key settings

# InfluxDB 1.x
INFLUX_HOST      = "localhost"
INFLUX_PORT      = 8086
INFLUX_DATABASE  = "meshtastic"
INFLUX_USER      = ""
INFLUX_PASSWORD  = ""
INFLUX_MEASUREMENT = "mesh_conditions"

# QTH — your station location
LATITUDE  = 39.95
LONGITUDE = -75.16

# Regional ducting sampling — distances (miles) in 8 compass directions
REGIONAL_SAMPLING_DISTANCES_MILES = [50, 75]   # set to [] to disable
ELEVATED_SCORE_THRESHOLD          = 1.5        # score at which a direction counts as elevated

# Alert thresholds (tropo_alert_v2)
MESH_ALERTS_ENABLED = True
START_THRESHOLD     = 4.0   # regional score that counts as a favourable window
RESET_THRESHOLD     = 2.0   # score below which a window is considered over
RESET_HOLD_HOURS    = 2     # hours below RESET_THRESHOLD before a window ends

FORECAST_WATCH_THRESHOLD = 2.0   # forecast score worth flagging on the outlook page
FORECAST_OUTLOOK_HOURS   = 72    # how far ahead the duration estimate looks
DAILY_FORECAST_MIN_SCORE = 2.0   # suppress the digest below this 24h peak

# Meshtastic TCP
MESH_HOST    = "meshtastic.local"
MESH_PORT    = 4403
MESH_CHANNEL = 0

TROPO_INFO_URL = "https://example.com/tropo"   # link included in all alert messages

# Status page
STATUS_HOST    = "0.0.0.0"
STATUS_PORT    = 5001
STATUS_SUBPATH = ""   # e.g. "/tropo" if behind a reverse proxy at a subpath

# SQLite state database
DB_FILE = "/var/lib/tropo/tropo_state.db"

SQLite State Database

tropo_collect.py and tropo_status.py share a single SQLite database (DB_FILE), created automatically on first run. It holds one thing:

  • Open-Meteo status — API availability, so the status page can say when scores are stale

WAL journal mode is enabled so tropo_status.py (Flask server) can read concurrently while the collector cron writes.

Alert Examples

Tropospheric Ducting Alert

tropo_alert_v2.py --test — the opening announcement:

TROPO OPENING [2026-05-21T14:00]
Local: 3.2/10
Regional: 4.8/10 - moderate.
Strongest ducting to the NE.
Also elevated: SW, S.
Forecast: ~8h, peak ~6.1 strong @18:00.
HWBS Tropo Data: https://rickelobe.com/tropo

The Forecast: line is omitted when there is no usable forecast, and reads 72h+ when conditions are not expected to fade inside the look-ahead window.

tropo_alert_v2.py --daily-forecast — morning digest:

TROPO FORECAST 24h - Sat Aug 22
Range boost: GOOD
Best:   19:00-Sun 01:00 (6h) toward SE
Also:   06:00-10:00 (4h) toward S
Effect: paths beyond the normal horizon may open
https://rickelobe.com/tropo

Effect reflects what was actually forecast — "paths beyond the normal horizon may open" when a trapping layer is expected, "slightly longer range than usual" when it is only super-refraction, and "range well beyond normal" at STRONG.

When DAILY_FORECAST_MIN_SCORE allows a quiet-day message, it collapses to a few lines:

TROPO FORECAST 24h - Sat Aug 22
Range boost: NONE
Normal conditions expected.
https://rickelobe.com/tropo

Data Sources

  • Atmosphere: Open-Meteo — HRRR model (CONUS only, updated hourly), GFS beyond 48 hours in the forecast

Important Notes

Regional Sampling and Geography

The regional ducting sampling points are computed from your QTH coordinates at fixed bearings and distances. Before deploying, check where your configured distances put all 16 sample points. Ocean points still score correctly — marine ducts are the strongest there are — but they describe paths over water that may not be paths anyone can use, so a coastal QTH will read a high regional max that its own bearings cannot reach. From Ardmore, PA all 8 points at 50 miles are on land; at 75 miles, the E and SE points fall off the New Jersey coast and the SW point falls around the Chesapeake Bay.

Open-Meteo Free Tier API Usage

The free tier limits are 10,000 calls/day, 5,000/hour, and 600/min. Open-Meteo applies a fractional multiplier for requests with more than 10 weather variables — this script requests 16 variables (2 surface + 7 temperature + 7 relative humidity pressure levels), so each location costs 1.6 API calls.

Each tropo_collect.py run makes two HTTP requests: one for the local QTH and one batch request for all regional sample points. Whether the batch request counts as 1 call or N calls (one per location) is not documented by Open-Meteo, so use the conservative per-location estimate when planning capacity.

Usage estimate at the default 20-minute cron interval (72 runs/day):

Counting assumption Calls/run Calls/day % of daily limit
Each location counted separately (conservative) 17 × 1.6 = 27.2 ~1,958 ~20%
Entire batch counts as one call (optimistic) 1.6 + 1.6 = 3.2 ~230 ~2%

At the conservative estimate and 20-minute cron, you have headroom for up to ~85 total regional sample locations before approaching the daily limit (10,000 ÷ 72 runs ÷ 1.6 multiplier). The current default of 16 points (8 directions × 2 distances) uses roughly 20% of that budget.


License

MIT

S
Description
No description provided
Readme MIT
3.5 MiB
0 Stars 1 Watchers 0 Forks
Languages
HTML 47.7%
Python 46.1%
JavaScript 4.4%
Shell 1.8%