LW IT Solutions
« Blog Overview /CCTV/Tutorials / Intelligent Alarm Scenarios: Integrating Frigate AI Detection...
Read this article in other languages:

Intelligent Alarm Scenarios: Integrating Frigate AI Detection in Home Assistant

Part 2 of 2 in the series Video surveillance on your own hardware

Intelligent Alarm Scenarios: Integrating Frigate AI Detection in Home Assistant
Contents
  1. 1. Integration Architecture: MQTT Broker & Frigate Integration
  2. 2. Step-by-Step MQTT & HACS Setup
  3. 3. Production-Ready Home Assistant Alarm Automation
  4. 4. Step-by-Step Notification Optimization & False-Positive Suppression
  5. 5. Summary & Architectural Value
  6. Questions and answers
  7. Sources

Integrating Frigate NVR with Home Assistant transforms passive video surveillance into an active, intelligent perimeter defense platform. Traditional motion-triggered automation engines generate constant false alerts caused by moving shadows or passing animals, rendering automated sirens and floodlights useless. By leveraging real-time MQTT object detection states and high-confidence AI bounding-box tracking from Frigate, Home Assistant can trigger precise deterrent actions—such as instant push notifications with annotated snapshots, floodlight activation, or siren warnings—exclusively when unauthorized human intruders cross designated security zones.

1. Integration Architecture: MQTT Broker & Frigate Integration

The communication bridge between Frigate NVR and Home Assistant relies on asynchronous MQTT messages and custom Home Assistant Integration components:

  • MQTT Event Stream: Frigate publishes real-time JSON payloads to the frigate/events topic whenever an object is detected, tracked, or updated across defined camera zones.
  • Frigate Home Assistant Integration: Installed via HACS (Home Assistant Community Store), this integration automatically creates binary sensors, camera entities, and media browser feeds inside Home Assistant.
  • Media Cache API Endpoint: High-resolution snapshots and video clips generated during detection events are exposed locally via secure API endpoints (e.g., /api/frigate/notifications/{event_id}/snapshot.jpg), allowing instant embedding into mobile alerts.
Cascade of five conditions filtering a Frigate MQTT event down to a real alarm, which then triggers floodlights, siren and a push notification
Every condition removes one class of false alarm before anything is triggered. Only an event that survives all five switches on the light, the siren and the notification.

2. Step-by-Step MQTT & HACS Setup

To establish the event telemetry pipeline, the custom integration must be authenticated and connected to the shared MQTT broker:

  1. MQTT Broker Verification: Ensure both Frigate NVR and Home Assistant are connected to the same Mosquitto MQTT broker instance. Verify that Frigate’s mqtt.host configuration points to the broker IP.
  2. Install Frigate via HACS: Open HACS in Home Assistant, search for Frigate under Integrations, download the repository, and restart Home Assistant Core.
  3. Add Integration Entry: Navigate to Settings > Devices & Services > Add Integration, select Frigate, and enter the local HTTP URL of the Frigate NVR instance (e.g., http://192.168.10.20:5000).

3. Production-Ready Home Assistant Alarm Automation

The following Home Assistant automation YAML script listens to Frigate MQTT event payloads, verifies zone boundaries, turns on floodlights, triggers a high-priority mobile alert with a snapshot image, and sounds an alarm siren when an intruder enters a restricted area at night:

alias: "Security: Intruder Detection Driveway Zone"
description: "Triggers floodlights, sirens, and actionable notifications with snapshots when a person is detected."
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: template
    value_template: "{{ trigger.payload_json['type'] == 'new' or (trigger.payload_json['type'] == 'update' and 'driveway_private' not in trigger.payload_json['before']['entered_zones']) }}"
  - condition: template
    value_template: "{{ trigger.payload_json['after']['label'] == 'person' }}"
  - condition: template
    value_template: "{{ 'driveway_private' in trigger.payload_json['after']['entered_zones'] }}"
  - condition: template
    value_template: "{{ trigger.payload_json['after']['top_score'] >= 0.80 }}"
  - condition: time
    after: "22:00:00"
    before: "06:00:00"
action:
  # 1. Turn on perimeter floodlights
  - service: light.turn_on
    target:
      entity_id: light.driveway_floodlights
    data:
      brightness_pct: 100
  # 2. Sound alarm siren for 15 seconds
  - service: siren.turn_on
    target:
      entity_id: siren.outdoor_siren
    data:
      duration: 15
  # 3. Send actionable mobile notification with high-res snapshot
  - service: notify.notify
    data:
      title: "🚨 INTRUDER DETECTED"
      message: "An unauthorized person was detected in the private driveway zone."
      data:
        image: "/api/frigate/notifications/{{ trigger.payload_json['after']['id'] }}/snapshot.jpg"
        tag: "intruder_driveway"
        priority: high
        ttl: 0
        clickAction: "/api/frigate/notifications/{{ trigger.payload_json['after']['id'] }}/clip.mp4"
mode: single

4. Step-by-Step Notification Optimization & False-Positive Suppression

To maintain absolute system reliability and prevent notification fatigue, granular filtering parameters must be enforced:

  1. Confidence Score Thresholding: Require a minimum top_score of 0.80 (80% probability) within the automation conditions to filter out ambiguous reflections or edge cases.
  2. Zone Transition Validation: Configure conditions using entered_zones rather than global motion to restrict active alarms exclusively to secure property boundaries.
  3. Notification Throttling: Set the automation execution mode to single with a delay buffer or rate limiter to prevent duplicate notifications during prolonged presence.

5. Summary & Architectural Value

What this tutorial achieves: The successful integration of Frigate NVR AI object detection with Home Assistant via MQTT and HACS, creating an automated, high-precision perimeter security response system.

Resulting value: Nuisance alerts caused by rain, shadows, or animals are completely eliminated. Active deterrents—such as floodlights, audio sirens, and actionable push notifications containing high-resolution snapshots and clip links—trigger exclusively upon verified human intrusion, delivering immediate situational awareness and robust perimeter protection without cloud subscription costs.

Questions and answers

Does the alerting still work when the internet connection is down?

For the most part. Detection in Frigate, the MQTT broker, the automation in Home Assistant, floodlight and siren all run on the local network and need no outside connection. The push notification to the phone is different: it does not travel directly from the server to the device but normally goes through Apple’s or Google’s notification services, so without an internet connection it does not reach a phone that is away from home. Only on the home Wi-Fi can the Companion app, depending on its settings, receive notifications directly from Home Assistant.

A second dependency sits in the image. The automation does not send a snapshot but a path, /api/frigate/notifications/…/snapshot.jpg; the phone fetches the image from Home Assistant only when the notification is displayed. Away from home this only works if Home Assistant is reachable from outside; otherwise the notification appears without an image and the clip cannot be opened.

An alarm that has to reach someone even when the line is down therefore needs a path that does not run over the same line, such as a mobile connection as a backup on the router. The siren on site is independent of all this.

Why does mode: single on its own not prevent duplicate notifications?

Because single only blocks a second run while the first is still in progress, and that run ends almost immediately after light, siren and notification: the siren’s 15 seconds are counted by the device, not by the automation. Only a final delay action, lasting a few minutes for instance, keeps the run open so that further triggers during that time are dropped. The notification’s tag parameter additionally ensures that a new notification on the phone replaces the older one with the same value instead of appearing next to it.

Video surveillance on your own hardware

  1. Storage and Bandwidth Engineering for Enterprise CCTV Networks
  2. Intelligent Alarm Scenarios: Integrating Frigate AI Detection in Home Assistant
Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in Touch

Briefly describe your project or inquiry for a tailored response. This site is protected by reCAPTCHA.

Write a comment

Experience with other cameras, lenses or recorders and questions about the setup are welcome here.

The email address is not published. Required fields are marked with an asterisk.

Articles & categories

CCTV

Follow this category by RSS

Cloud & AI

All 11 articles in this category Follow this category by RSS

Data Privacy

All 18 articles in this category Follow this category by RSS

Digital Analytics

All 58 articles in this category Follow this category by RSS

Digital Marketing

All 37 articles in this category Follow this category by RSS

IT & Networks

All 17 articles in this category Follow this category by RSS

Music Production

All 16 articles in this category Follow this category by RSS

Raspberry PI

Follow this category by RSS

SaaS & Internet Earning

Articles coming soon

Smart Home

All 18 articles in this category Follow this category by RSS

Web Development

All 11 articles in this category Follow this category by RSS

WordPress Plugins & Tricks

All 13 articles in this category Follow this category by RSS