Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rgregg/frigate-event-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Gregg committed Oct 7, 2024
2 parents 0819035 + 124c723 commit f604497
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag frigate-event-processor:$(date +%s)
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: rgregg/frigate-event-processor
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
111 changes: 111 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Frigate Event Processor

Frigate Event Processor (FEP) works with [Frigate](https://frigate.video) 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.


## Example Configuration File

```yaml
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
```
## Running with Docker Compose
The easiest way to run FEP is to add it to your Docker Compose environment where you are already
running Frigate and MQTT:
```yaml
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.

0 comments on commit f604497

Please sign in to comment.