CCTV Monitoring System
File: assistant/cctv_monitor.go (~1011 lines), assistant/reolink.go (57 lines)
The CCTV monitoring system provides autonomous surveillance of the dLAN property using a Reolink RLN8-410 NVR with 8 camera channels. It handles doorbell detection, anomaly alerts, overnight analysis, and RoboCop agent integration.
Camera Channels
| Channel | Name | Primary Use |
|---|---|---|
| 1 | Above Front Door | Entry surveillance |
| 2 | Driveway | Vehicle monitoring |
| 3 | Rear Garden | Perimeter |
| 4 | Side Gate | Access point |
| 5 | Front Door Doorbell | Doorbell + visitor detection |
| 6 | Kitchen | Internal |
| 7 | Office | Internal |
| 8 | Garage | Asset protection |
Event Types
| Type | Constant | Trigger |
|---|---|---|
| Person | AI_PEOPLE |
AI-detected person |
| Vehicle | AI_VEHICLE |
AI-detected vehicle |
| Animal | AI_ANIMAL |
AI-detected animal |
| Motion | MD |
General motion detection |
| Doorbell | DOORBELL |
Doorbell press |
Key Features
Doorbell Detection
HandleDoorbellPress()— Rate-limited (2-minute cooldown perDoorbellCooldownPeriod)- Captures snapshot from channel 5
- Sends to Home HQ WhatsApp group (
HomeHQGroupJID) - Triggers RoboCop agent for security analysis
Anomaly Detection
CheckForAnomaly()— Detects person events during user absence (>25 minutes, perMinAbsenceForAnomaly)- Rate-limited: 10-minute cooldown per
AnomalyAlertCooldown NotifyAnomaly()— Routes to RoboCop agent for investigation
Overnight Analysis
RunOvernightCheck()— Runs at 07:45 daily- Scans 23:00-07:45 window for events
- Counts person/vehicle/doorbell events per camera
- Triggers RoboCop agent analysis of overnight events
HTML Activity Log
AppendToHTMLLog()/createFullHTMLLog()— Weekly-cycle HTML log with dark theme- Auto-refresh capability
- Stored in
static/for web serving - Weekly cycle resets on Monday at midnight
State Persistence
CCTVMonitorStatesaved tologs/cctv_state.json- Tracks: last event time, last doorbell time, last anomaly alert, weekly cycle start, last overnight check date
Integration Points
- RoboCop agent — Triggered for doorbell events, anomaly analysis, overnight summaries
- Wakeup system —
BuildArrivalContext()provides "while you were away" summary - WhatsApp — Home HQ group notifications for doorbell and anomaly events
Reolink CCTV Tool
File: reolink.go
ReolinkCCTVTool() is the agent-facing tool that queries the NVR directly:
- Connects to
cctv.dlanviareolink_api_wrapper - Queries channels 1 (Above Front Door) and 5 (Front Door Doorbell)
- Returns recent recording metadata (last 24 hours)
- Classifies segments: < 15 min = event-triggered, longer = continuous
Key Constants
| Constant | Value | Purpose |
|---|---|---|
CCTVEventPollInterval |
2 min | NVR polling frequency |
DoorbellCooldownPeriod |
2 min | Doorbell notification cooldown |
AnomalyAlertCooldown |
10 min | Anomaly alert cooldown |
ArrivalEventCacheTTL |
5 min | Arrival data cache TTL |
MinAbsenceForAnomaly |
25 min | Threshold for "user away" |
MaxDoorbellSnapshots |
20 | Max retained snapshots |
DoorbellFolder |
doorbell |
Snapshot storage directory |
See also: Wakeup System