Why Smart Perimeter Defense Matters
Conventional CCTV records incidents but doesn’t deter proactively. Combining Frigate NVR with Home Assistant lets your property react immediately when a person enters a defined zone — making intruders aware they’ve been spotted while simultaneously alerting the homeowner.
Zone-Based Perimeter Architecture
Zone 1 (Gate) → Lights flash 3x + recording starts Zone 2 (Driveway) → Flood lights 100% + LINE notification Zone 3 (Porch) → Siren + PTZ pan + push notification
Each zone is a polygon drawn on the camera frame inside Frigate config. Home Assistant automations fire different responses based on published over MQTT.
Frigate config.yml: Zone Detection Setup
yaml cameras: front_gate: ffmpeg: inputs: - path: rtsp://192.168.1.201:554/stream1 roles: [detect, record] detect: width: 1920 height: 1080 fps: 5 zones: gate_zone: coordinates: 100,300,500,300,500,800,100,800 objects: - person driveway_zone: coordinates: 500,200,1400,200,1400,900,500,900 objects: - person record: enabled: true events: retain: default: 10 snapshots: enabled: true bounding_box: true
Home Assistant Automation: Zone Entry Sequence
yaml alias: Perimeter Defense — Gate Zone Person trigger: - platform: mqtt topic: frigate/events value_template: >- {{ value_json.after.camera == 'front_gate' and 'gate_zone' in value_json.after.current_zones and value_json.after.label == 'person' }} payload: 'true' condition: - condition: time after: "18:00:00" before: "06:00:00" action: - service: light.turn_on target: entity_id: light.gate_flood data: brightness_pct: 100 flash: short - delay: "00:00:02" - service: light.turn_on data: brightness_pct: 100 flash: short target: entity_id: light.gate_flood - service: notify.line_notify data: message: >- ⚠️ Person detected at gate {{ now().strftime('%H:%M') }} Snapshot: http://frigate.local/api/events/{{ trigger.payload_json.after.id }}/snapshot.jpg mode: single
PTZ Camera via ONVIF Integration
PTZ cameras supporting ONVIF (Hikvision, Dahua, Reolink) can be commanded from HA:
yaml camera: - platform: onvif host: 192.168.1.202 username: admin password: !secret ptz_password name: Porch PTZ
Define presets on the camera’s web interface (gate-facing, walkway-facing, etc.), then call them in automations with through .
Zone Response Matrix
| Zone | Daytime | Night | Alert | |---|---|---|---| | Gate | Record + snapshot | Flash lights + LINE | Always | | Driveway | LINE photo | Flood + siren 5s | Always | | Porch | Push + snapshot | PTZ + siren 10s + strobe | Always |
Preventing False Positives
Frigate’s object tracking means a single event won’t re-trigger, but add a 60-second cooldown to handle pets or passing vehicles:
yaml condition: - condition: template value_template: >- {{ (now() - states.automation.perimeter_driveway.last_triggered).seconds > 60 if states.automation.perimeter_driveway.last_triggered else true }}
ROI Summary
A Frigate + HA Smart Perimeter Defense system reduces intrusion response time from ~3 minutes (reviewing footage) to immediate, at 60–80% lower hardware cost than commercial CCTV monitoring systems.
