Frigate Event Processor (FEP) works with Frigate to monitor camera events and use rules to filter events which are then provided to an alerting system via MQTT.
FEP adds filtering capabiltiies so that every event that occurs doesn't generate a push notification to your device. You can filter based on multiple criteria, including:
- Camera
- Label
- Zone (required or ignored zones)
- Minimum event duration (filter out events that last less than X seconds)
- Maximum event duration (filter out events which started more than X seconds ago)
- Snapshot or Video
You can also easily implement a cooldown feature for a camera or label, to ensure that you won't receive repeated alerts for the same detection within a small period of time.
mqtt:
host: mqtt-server.lan
port: 1883
listen_topic: frigate/events
alert_topic: alerts/camera_system
frigate:
host: frigate-server.lan
port: 5000
ssl: false
alerts:
- camera: yard
enabled: true
labels:
- person
- camera: front_door
labels:
- car
- person
- package
zones:
ignore:
- zone: street
labels: ["car"] # ignore the label car in the parked_cars zone
- camera: backyard
labels:
- person
require:
- zone: steps
labels: ["*"]
alert_rules:
# Minimum duration of time an event is active before a notification is fired, 0 to disable
# Note this will delay processing of all alert notifications for at least this duration of
# time to make sure the event doesn't end first. Recommend to keep this to a low value to
# ensure timely delivery of alerts
min_event_duration: 1.1s
# maximum time since the event was created that will still generate an alert (this can be used
# to prevent alerts for parked cars and other items that are detected for a long time)
max_event_duration: 1m
# Require that a snapshot is avaialble before a notificaiton is fired
snapshot: false
# Require that a video is avaialble before a notification is fired
video: false
cooldown:
# Amount of time that must elapse before a notification is fired again for the same camera
camera: 0s # 30s or 5m or 1h
# Amount of time that must elapse before a notification is fired again for the same label on a camera
label: 1m
object_tracking:
# enable tracking location of labels on video frames to identify stationary objects and supress alerts
enabled: true
logging:
level: INFO
path: "./logs/frigate-processor.log"
max-keep: 10
The easiest way to run FEP is to add it to your Docker Compose environment where you are already running Frigate and MQTT:
services:
frigate:
# your frigate configuration here
event-processor:
container_name: frigate-event-processor
image: rgregg/frigate-event-processor:main
restart: unless-stopped
volumes:
- ./fep/logs:/app/logs
- ./fep/config.yaml:/app/config.yaml:ro
depends_on:
- frigate
FEP is light weight and only requires access to your MQTT server - you can run it on any box that has access to MQTT.
You can use FEP with Home Assistant to push notifications to your mobile device using an automation assoicated with the MQTT topic that FEP publishes on. Here is an example automation YAML:
alias: Frigate - Deliver Processed Events
description: Send mobile notifications when Frigate detects something
triggers:
- alias: When a Frigate event has been received
topic: alerts/camera_system/alert
variables:
event: "{{ trigger.payload_json }}"
camera: "{{ trigger.payload_json['camera'] }}"
id: "{{ trigger.payload_json['id'] }}"
message: "{{ trigger.payload_json['message'] }}"
trigger: mqtt
conditions: []
actions:
- alias: Send mobile notification
choose:
- conditions:
- alias: If the event has a snapshot
condition: template
value_template: "{{ event.image != none }}"
sequence:
- alias: Send notification with an image
data:
title: Home Assistant
message: "{{ message }}"
data:
url: /dashboard-cameras/{{ camera }}
clickAction: /dashboard-cameras/{{ camera }}
image: /api/frigate/notifications/{{ id }}/snapshot.jpg
group: frigate-{{ camera }}
tag: "{{ id }}"
enabled: true
action: notify.mobile_phone
alias: Send notification with a picture
- conditions: []
sequence:
- alias: Send notification without an image
data:
title: Home Assistant
message: "{{ message }}"
data:
url: /dashboard-cameras/{{ camera }}
clickAction: /dashboard-cameras/{{ camera }}
group: frigate-{{ camera }}
tag: "{{ id }}"
enabled: true
action: notify.mobile_phone
alias: Send notification without a picture
mode: parallel
max: 10