Skip to content

RyanSStephens/lora-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoRa Sensor Dashboard

Real-time LoRa sensor mesh monitoring dashboard with LLM-powered anomaly detection.

Sensors push telemetry (temperature, humidity, pressure, battery, RSSI) via HTTP or raw LoRa payloads. The backend detects anomalies using statistical thresholds and then uses Claude to analyze each anomaly in natural language. A Next.js dashboard shows live sensor status and an anomaly feed via WebSocket.

Architecture

LoRa Sensors → Gateway → POST /api/v1/readings
                              │
                              ├── Store in SQLite
                              ├── Broadcast via WebSocket
                              └── Anomaly Detection
                                    │
                                    ├── Statistical thresholds
                                    └── Claude LLM analysis
                                          │
                                          ▼
                              Next.js Dashboard (real-time)

Stack

Backend: FastAPI, SQLAlchemy, SQLite, Anthropic Claude, WebSocket Frontend: Next.js 14, TypeScript, TailwindCSS Infra: Docker Compose

Quick Start

# Backend
cd backend
cp .env.example .env  # add your Anthropic key
pip install -e .
uvicorn lora_dashboard.api.app:app --reload

# Frontend (separate terminal)
cd frontend
npm install
npm run dev

Open http://localhost:3000

API

Ingest

  • POST /api/v1/readings — structured sensor reading
  • POST /api/v1/readings/raw — raw LoRa payload (JSON or CSV)

Query

  • GET /api/v1/sensors — list all sensors
  • GET /api/v1/sensors/{id} — sensor detail with 24h stats
  • GET /api/v1/sensors/{id}/readings — recent readings
  • GET /api/v1/anomalies — list anomalies with LLM analysis

Real-time

  • WS /ws — WebSocket for live readings and anomaly alerts

Anomaly Detection

The system detects:

  • Temperature spikes/drops — deviation from 24h mean exceeding threshold
  • Humidity anomalies — same approach
  • Low battery — warning at 20%, critical at 10%
  • Weak signal — RSSI below -100 dBm

Each anomaly is analyzed by Claude to provide context on likely cause and recommended action.

Simulate Data

# Send a reading
curl -X POST "http://localhost:8000/api/v1/readings?sensor_id=garage-01&temperature=22.5&humidity=55&battery=87&rssi=-65"

# Send a raw LoRa payload
curl -X POST 'http://localhost:8000/api/v1/readings/raw?sensor_id=garage-01&payload={"temp":22.5,"hum":55}'

Dev

cd backend
pip install -e ".[dev]"
pytest tests/ -v
ruff check src/

About

Real-time LoRa sensor mesh dashboard with LLM-powered anomaly detection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors