-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.yaml
More file actions
228 lines (211 loc) · 7.89 KB
/
example.yaml
File metadata and controls
228 lines (211 loc) · 7.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# HomeSec Configuration Example
#
# Copy this file and customize for your setup:
# cp config/example.yaml config/config.yaml
#
# All secrets should be stored in .env (see .env.example)
# Reference them here using _env suffix (e.g., token_env: MY_TOKEN)
#
# Run with:
# homesec run --config config/config.yaml
version: 1
# =============================================================================
# Cameras - Define your video sources
# =============================================================================
cameras:
# RTSP camera (IP cameras, NVRs)
- name: front_door
source:
backend: rtsp
config:
# RTSP URL from environment variable (set in .env)
rtsp_url_env: FRONT_DOOR_RTSP_URL
# Optional: separate low-res stream for motion detection
# detect_rtsp_url_env: FRONT_DOOR_RTSP_SUB_URL
output_dir: "./recordings"
stream:
# Customize ffmpeg behavior (e.g., for flaky TCP streams)
ffmpeg_flags: ["-rtsp_transport", "tcp", "-vsync", "0"]
connect_timeout_s: 2.0 # RTSP connect timeout (seconds)
io_timeout_s: 2.0 # RTSP I/O timeout (seconds)
disable_hwaccel: false
motion:
pixel_threshold: 45 # Pixel difference threshold (0-255)
min_changed_pct: 1.0 # Min % of frame that must change (idle)
recording_sensitivity_factor: 2.0 # Recording keepalive sensitivity (>=1.0)
blur_kernel: 5 # Blur kernel size (reduces noise)
recording:
stop_delay: 10 # Seconds of no motion before stopping
max_recording_s: 60 # Max clip length before rotation
runtime:
frame_timeout_s: 2.0 # Timeout waiting for frames
frame_queue_size: 20 # Frame queue size
heartbeat_s: 30.0 # Heartbeat log interval
debug_motion: false
reconnect:
backoff_s: 1.0 # Backoff between reconnects
max_attempts: 0 # 0 = retry forever
detect_fallback_attempts: 3 # Switch detect stream to main after N failures
# FTP server (receive uploads from cameras that support FTP)
- name: ftp_camera
source:
backend: ftp
config:
host: "0.0.0.0"
port: 2121
root_dir: "./ftp_incoming"
anonymous: true
# For authenticated FTP:
# anonymous: false
# username_env: FTP_USERNAME
# password_env: FTP_PASSWORD
# Local folder (watch for new files)
- name: local_camera
source:
backend: local_folder
config:
watch_dir: "./recordings"
poll_interval: 1.0 # Seconds between folder scans
stability_threshold_s: 1.0 # Wait for file to stop growing
# =============================================================================
# Storage - Where to upload processed clips
# =============================================================================
storage:
backend: dropbox # Options: dropbox, local
# Backend-specific config
config:
root: "/homecam"
# Simple token auth (get from Dropbox App Console)
token_env: DROPBOX_TOKEN
# OR OAuth refresh flow (for long-running apps)
# app_key_env: DROPBOX_APP_KEY
# app_secret_env: DROPBOX_APP_SECRET
# refresh_token_env: DROPBOX_REFRESH_TOKEN
web_url_prefix: "https://www.dropbox.com/home"
# =============================================================================
# State Store - PostgreSQL for clip state tracking
# =============================================================================
state_store:
dsn_env: DB_DSN # e.g., postgresql+asyncpg://user:pass@localhost:5432/homesec
# =============================================================================
# Preview - Live preview config contract (v1 HLS; RTSP sources support on-demand preview)
# =============================================================================
preview:
enabled: false
backend: hls
token_ttl_s: 60
idle_timeout_s: 30.0
recording_policy: stop_on_recording # Use allow_during_recording for best-effort concurrent preview; may consume an extra RTSP session
config:
segment_duration_ms: 1000 # Lower latency means more segment churn
live_window_segments: 4 # Total window ~= segment_duration_ms * segment count
storage_dir: /tmp/homesec-preview # Prefer tmpfs; keep separate from recordings and other durable storage
audio_enabled: true
audio_codec: auto
video_codec: auto
# =============================================================================
# Notifiers - How to send alerts
# =============================================================================
# Optional: set to [] (or disable all entries) to run analysis-only with no external alerts.
notifiers:
# MQTT (for Home Assistant, Node-RED, etc.)
- backend: mqtt
config:
host: "localhost"
port: 1883
auth:
username_env: MQTT_USERNAME
password_env: MQTT_PASSWORD
topic_template: "homecam/alerts/{camera_name}"
qos: 1
retain: false
# SendGrid email
# - backend: sendgrid_email
# config:
# api_key_env: SENDGRID_API_KEY
# from_email: "alerts@example.com"
# from_name: "HomeSec"
# to_emails: ["you@example.com"]
# =============================================================================
# Filter - Object detection to filter clips
# =============================================================================
filter:
backend: yolo
config:
# Model downloads automatically to ./yolo_cache
# model_path: "yolo11n.pt" # Default model
max_workers: 4 # Parallel detection workers (plugin-specific)
classes:
- person
- car
- truck
- motorcycle
- bicycle
- dog
- cat
min_confidence: 0.5
sample_fps: 2 # Frames per second to analyze
min_box_h_ratio: 0.03 # Min box height as ratio of frame
# =============================================================================
# VLM - Vision Language Model for scene analysis
# =============================================================================
vlm:
backend: openai
trigger_classes: ["person"] # Only run VLM if these detected
run_mode: trigger_only # trigger_only | always | never
config:
api_key_env: OPENAI_API_KEY
model: "gpt-4o"
# For local/alternative providers:
# base_url: "http://localhost:1234/v1"
# model: "local-model-name"
preprocessing:
max_frames: 10 # Max frames to send to VLM
max_size: 1024 # Max dimension (pixels)
quality: 85 # JPEG quality (1-100)
# =============================================================================
# Alert Policy - When to send notifications
# =============================================================================
alert_policy:
backend: default
enabled: true
config:
min_risk_level: "medium" # Options: low, medium, high, critical
notify_on_activity_types:
- person_at_door
- delivery
- suspicious
notify_on_motion: false # Alert on any motion (no VLM required)
overrides:
front_door:
min_risk_level: "low"
notify_on_activity_types:
- person_at_door
- delivery
- suspicious
- animal
# =============================================================================
# Advanced Settings (optional)
# =============================================================================
# Retry settings for transient failures
# retry:
# max_attempts: 3
# backoff_s: 1.0
# Concurrency limits
# concurrency:
# max_clips_in_flight: 4
# upload_workers: 4
# filter_workers: 4
# vlm_workers: 2
# Periodic Postgres backups
# maintenance:
# postgres_backup:
# enabled: false
# interval: 24h
# keep_count: 5
# local_dir: ./backups/postgres
# timeout_s: 1800
# compression_level: 6
# upload:
# enabled: true
# storage_backend: primary