← Back to Notes

Home Security: Local-First Alerts

Dec 2025 Local-first Reliability Automation

Overview

I started thinking about a simple home surveillance and alerting system after realizing how easy it could be to set up. While staying at an Airbnb with a Ring system, I wondered what a more private, customizable, local-first version could look like.

Goal

Leave your MacBook open while you’re away and get alerted on your phone when motion is detected, including a snapshot and a short video clip. This isn’t meant to replace commercial security systems, but it can still be useful in constrained situations—for example, renters who can’t install permanent hardware but still want lightweight monitoring.

Constraints

Initial Design Considerations

The initial design avoided initiating a Discord livestream for each motion detection event due to limited experience with OpenCV and uncertainty regarding Discord's platform policies on programmatic control of livestreams in private channels. Instead, the system was designed to commence video recording upon motion detection, terminate recording when motion ceases (or after a brief delay), and transmit the resulting clip to a private Discord channel via webhook. However, this approach exhibited a critical vulnerability: if an intruder observed the webcam's illuminated indicator and disrupted the recording process, the entire event could remain undetected, rendering the system ineffective.

Revised Design Approach

To mitigate this risk, the system now captures and uploads a screenshot immediately upon motion detection, accompanied by an alert notification. This ensures notification delivery even if the subsequent video recording is compromised. An alert lacking an associated recording serves as a significant indicator of potential tampering, prompting immediate investigation. To minimize false positives, the system consistently uploads a fixed 30-second video segment, enabling verification of motion legitimacy. This architecture delivers a balance of simplicity, robustness, and security while maintaining ease of implementation and maintenance.

Links

Source code for the home security system.

GitHub