Skip to content

Commit bdbad2b

Browse files
committed
docs: add motion detection features, API documentation, and MQTT configuration updates
- Add Motion Detection Features section with real-time alerts, history, and notification settings - Add API Endpoints section with REST API documentation and camera data response example - Add motion detection node type indicators (📷 Basic vs 🎯 Motion) to dashboard controls - Add motion-related troubleshooting entries for detection and alerts - Update Camera model with node_type and capabilities fields for
1 parent 0df052c commit bdbad2b

10 files changed

Lines changed: 1136 additions & 380 deletions

File tree

README.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# 🛡️ OpenSentry Command Center
22

3-
**View and control all your security cameras from one dashboard.**
3+
**View and control all your security cameras from one dashboard with real-time motion detection.**
44

5-
**🔒 Fully Encrypted:** HTTPS web UI, RTSPS video streams, MQTT over TLS
5+
**🔒 Fully Encrypted:** HTTPS web UI, RTSPS video streams, MQTT over TLS
6+
**🎯 Motion Detection:** Real-time alerts, motion history, and smart notifications
67

78
![Dashboard](docs/images/dashboard.png)
89

@@ -112,19 +113,60 @@ Cameras auto-discover within 30 seconds.
112113

113114
---
114115

116+
## 🎯 Motion Detection Features
117+
118+
OpenSentry automatically detects and responds to motion from compatible camera nodes:
119+
120+
### Real-Time Motion Alerts
121+
- **Visual Indicators:** Red badge appears on camera feed when motion detected
122+
- **Toast Notifications:** Pop-up alerts for motion events
123+
- **Animation Effects:** Camera cards pulse when motion is active
124+
125+
### Motion History
126+
- Click **📜 Motion History** on any camera to view recent events
127+
- Stores last 100 motion events per camera
128+
- Shows timestamp and duration for each event
129+
130+
### Notification Settings
131+
Configure motion alerts in **Settings → Notifications**:
132+
- **Motion Detection Alerts:** Toggle motion notifications on/off
133+
- **Toast Notifications:** Enable/disable pop-up alerts
134+
- Preferences saved locally in your browser
135+
136+
### Supported Motion Nodes
137+
- [OpenSentry-MotionNode](https://github.com/SourceBox-LLC/OpenSentry-MotionNode) - Motion detection with OpenCV
138+
- Basic nodes show as "📷 Basic Camera Node"
139+
- Motion nodes show as "🎯 Motion Detection Node"
140+
141+
---
142+
115143
## 🎮 Dashboard Controls
116144

145+
### Camera Controls
146+
117147
| Button | Action |
118148
|--------|--------|
119149
| **▶ Start** | Start video stream |
120150
| **⏸ Pause** | Pause stream |
121151
| **⏻ Shutdown** | Turn off camera |
152+
| **📜 Motion History** | View recent motion events |
153+
| **❌ Forget** | Remove camera from system |
154+
155+
### Status Indicators
122156

123157
| Status | Meaning |
124158
|--------|---------|
125159
| 🟢 Streaming | Camera active |
126160
| 🟡 Idle | Paused |
127161
| 🔴 Offline | Not responding |
162+
| 🔴 MOTION DETECTED! | Motion currently active |
163+
164+
### Node Types
165+
166+
| Icon | Type | Features |
167+
|------|------|----------|
168+
| 📷 | Basic Camera Node | Live streaming only |
169+
| 🎯 | Motion Detection Node | Live streaming + motion detection |
128170

129171
---
130172

@@ -189,6 +231,42 @@ Access your Command Center from anywhere using [Tailscale](https://tailscale.com
189231
190232
---
191233

234+
## 🔌 API Endpoints
235+
236+
The Command Center provides REST API endpoints for integration:
237+
238+
| Endpoint | Method | Description |
239+
|----------|--------|-------------|
240+
| `/api/cameras` | GET | List all cameras with status and motion data |
241+
| `/api/camera/<id>/status` | GET | Get specific camera status |
242+
| `/api/camera/<id>/command` | POST | Send command (start/stop/shutdown) |
243+
| `/api/camera/<id>/forget` | DELETE | Remove camera from system |
244+
| `/api/regenerate-secret` | POST | Generate new security secret |
245+
246+
### Camera Data Response
247+
```json
248+
{
249+
"camera-id": {
250+
"name": "motion-cam-test",
251+
"status": "streaming",
252+
"node_type": "motion",
253+
"capabilities": "streaming,motion_detection",
254+
"motion_active": false,
255+
"motion_events": [
256+
{
257+
"event": "motion_start",
258+
"timestamp": 1234567890,
259+
"area_x": 100,
260+
"area_y": 200
261+
}
262+
],
263+
"last_seen": 1234567890
264+
}
265+
}
266+
```
267+
268+
---
269+
192270
## ❓ Troubleshooting
193271

194272
| Problem | Solution |
@@ -197,6 +275,8 @@ Access your Command Center from anywhere using [Tailscale](https://tailscale.com
197275
| **Can't log in** | Default: `admin` / `opensentry`. Check `.env` file. |
198276
| **Account locked** | Wait 5 minutes. |
199277
| **Port 5000 in use** | Stop other app or edit port in `docker-compose.yml` |
278+
| **Motion not detected** | Ensure using motion-capable node. Check MQTT connection. |
279+
| **No motion alerts** | Check notification settings in dashboard. |
200280

201281
**Still stuck?** Run `docker compose logs -f` and check for errors.
202282

opensentry_command/config.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,53 @@
11
"""
22
Configuration classes for OpenSentry Command Center.
33
"""
4+
45
import os
56
import hashlib
67
from datetime import timedelta
78

89

910
class Config:
1011
"""Base configuration class"""
11-
12+
1213
# Flask
13-
SECRET_KEY = os.environ.get('SECRET_KEY')
14-
14+
SECRET_KEY = os.environ.get("SECRET_KEY")
15+
1516
# Session timeout (minutes)
16-
SESSION_TIMEOUT_MINUTES = int(os.environ.get('SESSION_TIMEOUT', '30'))
17+
SESSION_TIMEOUT_MINUTES = int(os.environ.get("SESSION_TIMEOUT", "30"))
1718
PERMANENT_SESSION_LIFETIME = timedelta(minutes=SESSION_TIMEOUT_MINUTES)
1819
SESSION_REFRESH_EACH_REQUEST = True
19-
20+
2021
# Authentication
21-
OPENSENTRY_USERNAME = os.environ.get('OPENSENTRY_USERNAME', 'admin')
22-
OPENSENTRY_PASSWORD = os.environ.get('OPENSENTRY_PASSWORD', 'opensentry')
23-
22+
OPENSENTRY_USERNAME = os.environ.get("OPENSENTRY_USERNAME", "admin")
23+
OPENSENTRY_PASSWORD = os.environ.get("OPENSENTRY_PASSWORD", "opensentry")
24+
2425
# Rate limiting
2526
MAX_FAILED_ATTEMPTS = 5
2627
LOCKOUT_DURATION = 300 # 5 minutes
27-
ATTEMPT_WINDOW = 900 # 15 minutes
28-
29-
# MQTT (TLS on port 8883)
30-
MQTT_BROKER = os.environ.get('MQTT_BROKER', 'localhost')
31-
MQTT_PORT = int(os.environ.get('MQTT_PORT', '8883'))
32-
MQTT_USE_TLS = os.environ.get('MQTT_USE_TLS', 'true').lower() == 'true'
33-
MQTT_CLIENT_ID = 'opensentry_command_center'
34-
MQTT_USERNAME = os.environ.get('MQTT_USERNAME', 'opensentry')
35-
MQTT_PASSWORD = os.environ.get('MQTT_PASSWORD', 'opensentry')
36-
28+
ATTEMPT_WINDOW = 900 # 15 minutes
29+
30+
# MQTT
31+
MQTT_BROKER = os.environ.get(
32+
"MQTT_BROKER",
33+
"localhost", # Using host network mode, so always localhost
34+
)
35+
MQTT_PORT = int(os.environ.get("MQTT_PORT", "1883"))
36+
MQTT_USE_TLS = os.environ.get("MQTT_USE_TLS", "false").lower() == "true"
37+
MQTT_CLIENT_ID = "opensentry_command_center"
38+
MQTT_USERNAME = os.environ.get("MQTT_USERNAME", "opensentry")
39+
MQTT_PASSWORD = os.environ.get("MQTT_PASSWORD", "opensentry")
40+
3741
# RTSP
38-
RTSP_USERNAME = os.environ.get('RTSP_USERNAME', 'opensentry')
39-
RTSP_PASSWORD = os.environ.get('RTSP_PASSWORD', 'opensentry')
40-
42+
RTSP_USERNAME = os.environ.get("RTSP_USERNAME", "opensentry")
43+
RTSP_PASSWORD = os.environ.get("RTSP_PASSWORD", "opensentry")
44+
4145
# Single secret for credential derivation
42-
OPENSENTRY_SECRET = os.environ.get('OPENSENTRY_SECRET', '')
43-
46+
OPENSENTRY_SECRET = os.environ.get("OPENSENTRY_SECRET", "")
47+
4448
# mDNS
45-
MDNS_SERVICE_TYPE = '_opensentry._tcp.local.'
46-
49+
MDNS_SERVICE_TYPE = "_opensentry._tcp.local."
50+
4751
@classmethod
4852
def init_secret_key(cls):
4953
"""Generate secret key if not provided"""
@@ -56,9 +60,11 @@ def init_secret_key(cls):
5660

5761
class DevelopmentConfig(Config):
5862
"""Development configuration"""
63+
5964
DEBUG = True
6065

6166

6267
class ProductionConfig(Config):
6368
"""Production configuration"""
69+
6470
DEBUG = False

0 commit comments

Comments
 (0)