Skip to main content

Frigate Event Handler

GitHub Release Python Versions Project Maintenance License Made with Love in Norway

A tool that listens to Frigate events and generates AI-powered descriptions of detected events using vision and language models.

Features

  • Connects to Frigate via MQTT to receive real-time events
  • Processes event video clips using AI vision models
  • Generates natural language descriptions of events
  • Supports multiple cameras with camera-specific configurations
  • Configurable frame processing (resizing, similarity detection, grid layout)
  • Customizable prompts for different camera contexts

Installation

pip install frigate-event-handler

Usage

frigate-event-handler -c config.yml

Command Line Options

usage: frigate-event-handler [-h] [-V] [-v] [--debug] [-c CONFIG]

Frigate event handler.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -v, --verbose         Logging verbosity level
  --debug               Enable debug mode
  --debug-dir DEBUG_DIR
                        Directory to output debug files to.
  -c CONFIG, --config CONFIG
                        Configuration file

Configuration

The tool uses a YAML configuration file to specify connection details and behavior. Here's a minimal configuration example:

mqtt:
  host: localhost
  port: 1883
  topic: frigate/events

frigate:
  base_url: http://localhost:5000/api

vision_agent:
  api_key: your-llm-api-key
  vision_prompt: |
    Describe what you see in these surveillance camera frames.
  refine_prompt: |
    Rewrite this surveillance event description for a notification.

See reference config for a complete configuration file with all available options and their descriptions.

Camera-Specific Configuration

You can override global vision agent settings for specific cameras:

vision_agent:
  # Global settings here
  cameras:
    front_door:
      prompt_context: |
        This camera faces the front door entrance.
    backyard:
      prompt_context: |
        This camera overlooks the backyard area.

How It Works

  1. The tool subscribes to Frigate's MQTT events
  2. When an event is received, it:
    • Downloads the event video clip from Frigate
    • Extracts frames from the video
    • Processes frames (resize, similarity detection, etc.)
    • Sends frames to the vision model for analysis
    • Refines the description using a language model
  3. The resulting description is then posted back to frigate

Frame Processing Options

Frame Similarity Detection

The tool can remove similar frames before sending them to the vision model:

vision_agent:
  remove_similar_frames: true
  hashing_max_frames: 200
  hash_size: 12  # Lower = more aggressive similarity matching

Grid Layout

Frames can be arranged in a grid:

vision_agent:
  stack_grid: true
  stack_grid_size: [3, 3]  # 3x3 grid

Frame Resizing

Control frame dimensions sent to the vision model:

vision_agent:
  resize_video: [640, 360]  # [width, height]

Debug Mode

Enable debug mode to save processed frames and API responses:

frigate-event-handler --debug -c config.yml

Debug files will be saved to ./debug by default, or to a custom directory specified with the --debug-dir option.

Debug mode and debug directory can also be set in the configuration file.

Requirements

  • Python 3.12+
  • MQTT broker
  • Frigate instance
  • Access to an LLM API (OpenAI compatible)

Metadata

Release files for frigate-event-handler 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frigate-event-handler 0.3.1
File Size Uploaded Provenance
frigate_event_handler-0.3.1.tar.gz 11.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for frigate-event-handler 0.3.1
File Interpreter ABI Platform
frigate_event_handler-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / frigate_event_handler-0.3.1.tar.gz

Download URL frigate_event_handler-0.3.1.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3e2758b0b5d0cc4697cfd1d0d726d2f6038785e1e41a4c35f3d4cfbd0ab7f5c5
BLAKE2b-256 checksum
How to use checksums
0e33a8fa83bbce4ca5b0e479520de147b3910affa9838c7faf5b7c246170698a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.7

Release files / frigate_event_handler-0.3.1-py3-none-any.whl

Download URL frigate_event_handler-0.3.1-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfa7fd64e2941b5255bb96a8d36df93842ea11d3d3c949aa6398b4302e32fbac
BLAKE2b-256 checksum
How to use checksums
5913516ab6971c705c0694e06d496b9ea503c42cea751b69da24b74dfb8c1474
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.7

Security for frigate-event-handler 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page