Files
esp32-web/docs/CHEATSHEET.md
user e6e7b622b2 docs: Add project documentation
- README.md: Quick start, API endpoints, ports
- PROJECT.md: Architecture, components, data models
- ROADMAP.md: Version milestones (v0.1.x - v1.0.0)
- TASKS.md: Current sprint tasks
- TODO.md: Backlog items
- docs/INSTALL.md: Setup and deployment
- docs/USAGE.md: API examples
- docs/CHEATSHEET.md: Quick reference
2026-02-05 21:06:05 +01:00

98 lines
2.2 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
```
## 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
```
## 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 |
## 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 |