Skip to main content

No project description provided

Project description

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
  -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.

Requirements

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frigate_event_handler-0.3.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

frigate_event_handler-0.3.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file frigate_event_handler-0.3.0.tar.gz.

File metadata

  • Download URL: frigate_event_handler-0.3.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.7

File hashes

Hashes for frigate_event_handler-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9010a6468a98d63fa798a58cc9e0bf4a34f6de52020a8b24fcac919e95b09fd0
MD5 89c1a088d8e2b99014211594398e7d8b
BLAKE2b-256 044b966c6b52833d63c7d7242453007438deeeea8103b87eb48a7d93a35445f5

See more details on using hashes here.

File details

Details for the file frigate_event_handler-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for frigate_event_handler-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd1ae287a5b8daf797ad0fa7cd22c6e5996ad09731b061135fa8f490f714726e
MD5 1775563b0833d04ee210900a501676d9
BLAKE2b-256 f37b8e67b652c856930953b84c068f50e47ec31e3f8aece9df6883daff729f45

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page