Files
esp32-web/docs/CHEATSHEET.md
user dfbd2a2196 feat: v0.1.4 — device intelligence dashboard
Add tabbed dashboard at /dashboard/ with three D3.js visualizations:
- Vendor treemap (devices grouped by type and vendor)
- SSID social graph (force-directed, shared probed SSIDs as edges)
- Fingerprint clusters (packed circles by device behavior)

Intelligence API endpoints at /api/v1/intelligence/ with param
validation. Dashboard built on htmx + Pico CSS dark theme + D3 v7,
all vendored locally (make vendor). 13 new tests (59 total).
2026-02-06 18:59:53 +01:00

114 lines
2.8 KiB
Markdown

# ESP32-Web Cheatsheet
## Server Management
```bash
make start # Start server
make stop # Stop server
make restart # Restart server
make status # Show PID + uptime
make logs # Tail logs
make dev # Run with debug mode
```
## Database
```bash
make migrate # Apply migrations
make migrate-init # Initialize migrations
make migrate-create msg="description" # Create migration
```
## Testing
```bash
make test # Run all tests
pytest -v # Verbose output
pytest -k test_sensors # Run specific tests
```
## Static Assets
```bash
make vendor # Download Pico CSS, htmx, D3.js to static/vendor/
```
## Container
```bash
make build # Build image
make container-run # Run container
make container-stop # Stop container
make container-logs # View logs
```
## API Quick Reference
```bash
# Health
curl localhost:5500/health
# Sensors
curl localhost:5500/api/v1/sensors
curl localhost:5500/api/v1/sensors/HOSTNAME
curl -X POST localhost:5500/api/v1/sensors/HOSTNAME/command -H "Content-Type: application/json" -d '{"command":"STATUS"}'
# Devices
curl localhost:5500/api/v1/devices
curl "localhost:5500/api/v1/devices?type=ble&limit=50"
curl localhost:5500/api/v1/devices/MAC
# Alerts
curl localhost:5500/api/v1/alerts
curl "localhost:5500/api/v1/alerts?type=deauth&hours=48"
# Events
curl localhost:5500/api/v1/events
curl "localhost:5500/api/v1/events?type=presence"
# Probes
curl localhost:5500/api/v1/probes
curl localhost:5500/api/v1/probes/ssids
# Stats
curl localhost:5500/api/v1/stats
# Intelligence (Device Intelligence Dashboard)
curl localhost:5500/api/v1/intelligence/vendor-treemap
curl "localhost:5500/api/v1/intelligence/ssid-graph?hours=24&min_shared=1&limit=200"
curl "localhost:5500/api/v1/intelligence/fingerprint-clusters?hours=24"
# Dashboard
open http://localhost:5500/dashboard/
```
## Query Parameters
| Parameter | Endpoints | Description |
|-----------|-----------|-------------|
| type | devices, alerts, events | Filter by type |
| hours | alerts, events, probes | Time window (default: 24) |
| limit | devices, alerts, events, probes | Max results (default: 100) |
| offset | devices, alerts, events, probes | Skip N results |
| ssid | probes | Filter by SSID |
| sensor_id | alerts, events | Filter by sensor |
| hours | intelligence/ssid-graph, intelligence/fingerprint-clusters | Time window (default: 24) |
| min_shared | intelligence/ssid-graph | Min shared SSIDs for link (default: 1) |
## Files
| File | Description |
|------|-------------|
| `/tmp/esp32-web.pid` | Server PID file |
| `/tmp/esp32-web.log` | Server log file |
| `instance/esp32.db` | SQLite database |
| `.env` | Environment config |
## Ports
| Port | Protocol | Description |
|------|----------|-------------|
| 5500 | TCP | HTTP API |
| 5500 | UDP | Sensor data |
| 5501 | UDP | Sensor commands |