# OpenCV parcel detector uses ESP32 camera and Home Assistant with 45-second confirmation

> **Key takeaway:** A low-power ESP32-based camera with a custom OpenCV Python service and three-layer image validation achieves reliable parcel detection without cloud dependencies or continuous video streaming.

**Published:** 2026-11-04T15:53:18+00:00 
**Source:** Adafruit Electronics 
**Category:** open-hardware 
**Canonical URL:** https://fosswire.org/news/opencv-parcel-detector-uses-esp32-camera-and-home-assistant-.html 

## Summary
Brian Dorey has published a complete open-source parcel detection system that combines a StackyFi ESP32 camera board with a Python OpenCV service and Home Assistant notifications. The hardware fits inside a modified UK socket cover plate only 2cm deep, making it unobtrusive for doorway mounting. Rather than streaming video, the ESP32 runs an Arduino sketch that serves a single 1280 x 1024 JPEG on request, minimizing power consumption and network load.

The detection logic runs on a separate machine and applies three parallel checks—structural comparison, luminance analysis, and color matching—to avoid false triggers from passing clouds, moving shadows, and white balance drift. A detected change must persist for 45 seconds before the system fires a Home Assistant notification, filtering out transient motion. Testing showed the threshold successfully ignored a 3% zone change while catching a small parcel that altered 6.5% of the monitored area. All code and documentation are available on GitHub.

## Hardware and detection pipeline
- **ESP32 camera module:** The StackyFi board with an attached camera module runs an Arduino sketch that connects to WiFi and serves a single 1280 x 1024 JPEG image on request, with no streaming capability or configuration web interface.
- **Physical integration:** The entire assembly mounts inside a blank UK socket cover plate approximately 2cm in height, painted white to blend into a doorway environment.
- **Three-layer validation:** The Python OpenCV service compares a cropped zone against a reference image using structure, luminance, and color checks to distinguish actual objects from lighting artifacts and white balance shifts.
- **Temporal confirmation:** A change must remain stable for 45 seconds before the system reports a parcel, preventing alerts from brief motion events.
- **Threshold calibration:** Testing established that a 3% zone change represents normal environmental variation, while a 6.5% change from a small parcel crosses the detection threshold.

## Why it matters
This project demonstrates how open-source computer vision and low-cost ESP32 hardware can replace cloud-dependent commercial doorbell cameras for privacy-conscious home automation users. The explicit availability of Arduino firmware and Python detection code on GitHub gives makers and embedded developers a reproducible foundation for similar monitoring tasks without proprietary services or subscription fees.