Files
meshcore-stats/.envrc.example
Jorijn Schrijvershof 0f8b0a3492 Initial release: MeshCore Stats monitoring system
A Python-based monitoring system for MeshCore LoRa mesh networks.
Collects metrics from companion and repeater nodes, stores them in
a SQLite database, and generates a static website with interactive
SVG charts and statistics.

Features:
- Data collection from local companion and remote repeater nodes
- SQLite database with EAV schema for flexible metric storage
- Interactive SVG chart generation with matplotlib
- Static HTML site with day/week/month/year views
- Monthly and yearly statistics reports (HTML, TXT, JSON)
- Light and dark theme support
- Circuit breaker for unreliable LoRa connections
- Battery percentage calculation from 18650 discharge curves
- Automated releases via release-please

Live demo: https://meshcore.jorijn.com
2026-01-04 19:37:57 +01:00

119 lines
5.2 KiB
Plaintext

# MeshCore Stats Configuration
# Copy this file to .envrc and customize for your setup:
# cp .envrc.example .envrc
#
# If using direnv, it will automatically load when you cd into this directory.
# Otherwise, source it manually: source .envrc
layout python3
# =============================================================================
# Connection Settings
# =============================================================================
export MESH_TRANSPORT=serial
export MESH_SERIAL_PORT=/dev/ttyUSB0 # Adjust for your system (e.g., /dev/ttyACM0, /dev/cu.usbserial-*)
export MESH_SERIAL_BAUD=115200
export MESH_DEBUG=0 # Set to 1 for verbose meshcore debug output
# =============================================================================
# Remote Repeater Identity
# =============================================================================
# At least REPEATER_NAME or REPEATER_KEY_PREFIX is required to identify your repeater
export REPEATER_NAME="Your Repeater Name" # Advertised name shown in contacts
# export REPEATER_KEY_PREFIX="a1b2c3" # Alternative: hex prefix of public key
export REPEATER_PASSWORD="your-password" # Admin password for repeater login
# =============================================================================
# Display Names (shown in UI)
# =============================================================================
export REPEATER_DISPLAY_NAME="My Repeater"
export COMPANION_DISPLAY_NAME="My Companion"
# Public key prefixes (shown below node name in sidebar, e.g., "!a1b2c3d4")
# export REPEATER_PUBKEY_PREFIX="!a1b2c3d4"
# export COMPANION_PUBKEY_PREFIX="!e5f6g7h8"
# =============================================================================
# Location Metadata (for reports and sidebar display)
# =============================================================================
export REPORT_LOCATION_NAME="City, Country" # Full location name for reports
export REPORT_LOCATION_SHORT="City, XX" # Short version for sidebar/meta
export REPORT_LAT=0.0 # Latitude in decimal degrees
export REPORT_LON=0.0 # Longitude in decimal degrees
export REPORT_ELEV=0 # Elevation
export REPORT_ELEV_UNIT=m # "m" for meters, "ft" for feet
# =============================================================================
# Hardware Info (shown in sidebar)
# =============================================================================
export REPEATER_HARDWARE="Your Repeater Model" # e.g., "SenseCAP P1-Pro", "LILYGO T-Beam"
export COMPANION_HARDWARE="Your Companion Model" # e.g., "Elecrow ThinkNode-M1", "Heltec V3"
# =============================================================================
# Radio Configuration Presets
# =============================================================================
# Uncomment ONE preset below that matches your MeshCore configuration,
# or set custom values. These are for display purposes only.
# MeshCore EU/UK Narrow (default)
export RADIO_FREQUENCY="869.618 MHz"
export RADIO_BANDWIDTH="62.5 kHz"
export RADIO_SPREAD_FACTOR="SF8"
export RADIO_CODING_RATE="CR8"
# # MeshCore EU/UK Wide
# export RADIO_FREQUENCY="869.525 MHz"
# export RADIO_BANDWIDTH="250 kHz"
# export RADIO_SPREAD_FACTOR="SF10"
# export RADIO_CODING_RATE="CR5"
# # MeshCore US Standard
# export RADIO_FREQUENCY="906.875 MHz"
# export RADIO_BANDWIDTH="250 kHz"
# export RADIO_SPREAD_FACTOR="SF10"
# export RADIO_CODING_RATE="CR5"
# # MeshCore US Fast
# export RADIO_FREQUENCY="906.875 MHz"
# export RADIO_BANDWIDTH="500 kHz"
# export RADIO_SPREAD_FACTOR="SF7"
# export RADIO_CODING_RATE="CR5"
# # MeshCore ANZ (Australia/New Zealand)
# export RADIO_FREQUENCY="917.0 MHz"
# export RADIO_BANDWIDTH="250 kHz"
# export RADIO_SPREAD_FACTOR="SF10"
# export RADIO_CODING_RATE="CR5"
# =============================================================================
# Intervals and Timeouts
# =============================================================================
export COMPANION_STEP=60 # Collection interval for companion (seconds)
export REPEATER_STEP=900 # Collection interval for repeater (seconds, 15min default)
export REMOTE_TIMEOUT_S=10 # Minimum timeout for LoRa requests
export REMOTE_RETRY_ATTEMPTS=2 # Number of retry attempts
export REMOTE_RETRY_BACKOFF_S=4 # Seconds between retries
# Circuit breaker settings (prevents spamming LoRa when repeater is unreachable)
export REMOTE_CB_FAILS=6 # Failures before circuit breaker opens
export REMOTE_CB_COOLDOWN_S=3600 # Cooldown period in seconds (1 hour)
# =============================================================================
# Paths
# =============================================================================
export STATE_DIR=./data/state # SQLite database and circuit breaker state
export OUT_DIR=./out # Generated static site output
# =============================================================================
# Optional
# =============================================================================
export REPEATER_FETCH_ACL=0 # Set to 1 to fetch ACL from repeater