Frigate + Home Assistant + MQTT
Complete smart home surveillance stack with AI-powered NVR, home automation, and MQTT broker for seamless integration.
Overview
Frigate is an open-source Network Video Recorder (NVR) built specifically for real-time AI object detection on IP cameras. Unlike traditional surveillance systems that simply record footage, Frigate uses machine learning models to intelligently detect people, vehicles, and other objects in real-time, drastically reducing false alerts from shadows, rain, or swaying trees. It leverages hardware acceleration through Google Coral TPUs, Intel QuickSync, or NVIDIA GPUs to perform efficient AI inference without overwhelming your system resources. This surveillance stack combines Frigate's intelligent video analysis with Home Assistant's powerful automation engine and Mosquitto's lightweight MQTT messaging. Frigate publishes detection events to MQTT topics that Home Assistant consumes, enabling sophisticated automation workflows like sending notifications when a person is detected at your front door, turning on lights when motion is detected at night, or recording clips only when specific objects are identified. The MQTT broker acts as the central nervous system, ensuring reliable message delivery between Frigate's AI detections and Home Assistant's automation responses. This configuration is ideal for privacy-conscious homeowners who want professional-grade surveillance without cloud dependencies, smart home enthusiasts building comprehensive automation systems, and security-focused users who need intelligent video analytics with local processing. The combination provides enterprise-level surveillance capabilities while maintaining complete local control over your video feeds and detection data.
Key Features
- Real-time AI object detection with configurable zones and object filters
- Hardware acceleration support for Google Coral TPU, Intel QuickSync, and NVIDIA GPU
- MQTT-based event publishing for instant Home Assistant automation triggers
- Frigate integration in Home Assistant for camera feeds, clips, and detection management
- Intelligent recording that saves storage by capturing only relevant events
- Web-based dashboard with live camera feeds and detection timeline
- RTSP re-streaming for accessing camera feeds from multiple clients
- Home Assistant automation engine with 2000+ device integrations for complex workflows
Common Use Cases
- 1Home security system with AI-powered person and vehicle detection at entry points
- 2Smart doorbell replacement using existing IP cameras with Home Assistant notifications
- 3Automated lighting and security responses based on intelligent motion detection
- 4Pet monitoring with automated feeding schedules triggered by animal detection
- 5Business surveillance with after-hours alerts and automated security responses
- 6Privacy-focused family monitoring without cloud storage or third-party services
- 7Integration with existing smart home devices for comprehensive automation workflows
Prerequisites
- Minimum 2GB RAM for Home Assistant and Frigate AI processing (4GB+ recommended)
- IP cameras with RTSP stream support for Frigate video input
- Basic understanding of YAML configuration for Frigate camera setup
- Network access to camera RTSP streams from Docker host
- Optional: Google Coral TPU, Intel GPU, or NVIDIA GPU for hardware acceleration
- Understanding of MQTT topics and Home Assistant integration concepts
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 # MQTT Broker - Central message hub3 mosquitto: 4 image: eclipse-mosquitto:25 container_name: mosquitto6 restart: unless-stopped7 volumes: 8 - ./mosquitto/config:/mosquitto/config9 - ./mosquitto/data:/mosquitto/data10 - ./mosquitto/log:/mosquitto/log11 ports: 12 - "1883:1883"13 - "9001:9001"14 command: mosquitto -c /mosquitto/config/mosquitto.conf1516 # Frigate NVR - AI-powered camera system17 frigate: 18 image: ghcr.io/blakeblackshear/frigate:stable19 container_name: frigate20 restart: unless-stopped21 privileged: true22 shm_size: 256mb23 depends_on: 24 - mosquitto25 devices: 26 - /dev/bus/usb:/dev/bus/usb # USB Coral TPU (optional)27 # - /dev/dri/renderD128:/dev/dri/renderD128 # Intel GPU (optional)28 volumes: 29 - ./frigate/config:/config30 - ./frigate/media:/media/frigate31 - type: tmpfs32 target: /tmp/cache33 tmpfs: 34 size: 100000000035 ports: 36 - "5000:5000" # Web UI37 - "8554:8554" # RTSP feeds38 - "8555:8555/tcp"39 - "8555:8555/udp"40 environment: 41 - FRIGATE_RTSP_PASSWORD=${RTSP_PASSWORD:-changeme}42 - FRIGATE_MQTT_HOST=mosquitto43 - FRIGATE_MQTT_PORT=188344 - FRIGATE_MQTT_USER=${MQTT_USER:-}45 - FRIGATE_MQTT_PASSWORD=${MQTT_PASSWORD:-}4647 # Home Assistant - Home automation platform48 homeassistant: 49 image: ghcr.io/home-assistant/home-assistant:stable50 container_name: homeassistant51 restart: unless-stopped52 depends_on: 53 - mosquitto54 - frigate55 volumes: 56 - ./homeassistant/config:/config57 - /etc/localtime:/etc/localtime:ro58 ports: 59 - "8123:8123"60 environment: 61 - TZ=${TZ:-UTC}6263networks: 64 default: 65 driver: bridge.env Template
.env
1# Timezone2TZ=Europe/London34# MQTT Credentials (optional, for secured setup)5MQTT_USER=6MQTT_PASSWORD=78# Frigate RTSP Password9RTSP_PASSWORD=changeme1011# ============================================12# SETUP INSTRUCTIONS13# ============================================1415# 1. Create Mosquitto config:16# mkdir -p mosquitto/config mosquitto/data mosquitto/log17# cat > mosquitto/config/mosquitto.conf << 'EOF'18# listener 188319# listener 900120# protocol websockets21# allow_anonymous true22# persistence true23# persistence_location /mosquitto/data/24# log_dest file /mosquitto/log/mosquitto.log25# EOF2627# 2. Create Frigate config:28# mkdir -p frigate/config frigate/media29# cat > frigate/config/config.yml << 'EOF'30# mqtt:31# enabled: true32# host: mosquitto33# port: 188334# topic_prefix: frigate35# client_id: frigate36#37# detectors:38# cpu1:39# type: cpu40#41# cameras:42# front_door:43# ffmpeg:44# inputs:45# - path: rtsp://user:pass@camera-ip:554/stream46# roles:47# - detect48# - record49# detect:50# enabled: true51# width: 128052# height: 72053# fps: 554# record:55# enabled: true56# retain:57# days: 758# snapshots:59# enabled: true60# retain:61# default: 762# EOF6364# 3. In Home Assistant, add MQTT integration:65# Settings > Devices & Services > Add Integration > MQTT66# Broker: mosquitto (or the container IP)67# Port: 18836869# 4. Install Frigate integration in HACS or manually:70# Settings > Devices & Services > Add Integration > Frigate71# URL: http://frigate:5000Usage Notes
- 1Frigate UI at http://localhost:5000
- 2Home Assistant at http://localhost:8123
- 3MQTT broker at localhost:1883
- 4Create mosquitto/config/mosquitto.conf before starting
- 5Create frigate/config/config.yml with your cameras
- 6Add MQTT integration in Home Assistant for Frigate events
- 7Install Frigate integration in Home Assistant for full control
- 8Frigate sends motion/object events via MQTT to Home Assistant
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
mosquitto
mosquitto:
image: eclipse-mosquitto:2
container_name: mosquitto
restart: unless-stopped
volumes:
- ./mosquitto/config:/mosquitto/config
- ./mosquitto/data:/mosquitto/data
- ./mosquitto/log:/mosquitto/log
ports:
- "1883:1883"
- "9001:9001"
command: mosquitto -c /mosquitto/config/mosquitto.conf
frigate
frigate:
image: ghcr.io/blakeblackshear/frigate:stable
container_name: frigate
restart: unless-stopped
privileged: true
shm_size: 256mb
depends_on:
- mosquitto
devices:
- /dev/bus/usb:/dev/bus/usb
volumes:
- ./frigate/config:/config
- ./frigate/media:/media/frigate
- type: tmpfs
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "5000:5000"
- "8554:8554"
- 8555:8555/tcp
- 8555:8555/udp
environment:
- FRIGATE_RTSP_PASSWORD=${RTSP_PASSWORD:-changeme}
- FRIGATE_MQTT_HOST=mosquitto
- FRIGATE_MQTT_PORT=1883
- FRIGATE_MQTT_USER=${MQTT_USER:-}
- FRIGATE_MQTT_PASSWORD=${MQTT_PASSWORD:-}
homeassistant
homeassistant:
image: ghcr.io/home-assistant/home-assistant:stable
container_name: homeassistant
restart: unless-stopped
depends_on:
- mosquitto
- frigate
volumes:
- ./homeassistant/config:/config
- /etc/localtime:/etc/localtime:ro
ports:
- "8123:8123"
environment:
- TZ=${TZ:-UTC}
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 # MQTT Broker - Central message hub5 mosquitto:6 image: eclipse-mosquitto:27 container_name: mosquitto8 restart: unless-stopped9 volumes:10 - ./mosquitto/config:/mosquitto/config11 - ./mosquitto/data:/mosquitto/data12 - ./mosquitto/log:/mosquitto/log13 ports:14 - "1883:1883"15 - "9001:9001"16 command: mosquitto -c /mosquitto/config/mosquitto.conf1718 # Frigate NVR - AI-powered camera system19 frigate:20 image: ghcr.io/blakeblackshear/frigate:stable21 container_name: frigate22 restart: unless-stopped23 privileged: true24 shm_size: 256mb25 depends_on:26 - mosquitto27 devices:28 - /dev/bus/usb:/dev/bus/usb # USB Coral TPU (optional)29 # - /dev/dri/renderD128:/dev/dri/renderD128 # Intel GPU (optional)30 volumes:31 - ./frigate/config:/config32 - ./frigate/media:/media/frigate33 - type: tmpfs34 target: /tmp/cache35 tmpfs:36 size: 100000000037 ports:38 - "5000:5000" # Web UI39 - "8554:8554" # RTSP feeds40 - "8555:8555/tcp"41 - "8555:8555/udp"42 environment:43 - FRIGATE_RTSP_PASSWORD=${RTSP_PASSWORD:-changeme}44 - FRIGATE_MQTT_HOST=mosquitto45 - FRIGATE_MQTT_PORT=188346 - FRIGATE_MQTT_USER=${MQTT_USER:-}47 - FRIGATE_MQTT_PASSWORD=${MQTT_PASSWORD:-}4849 # Home Assistant - Home automation platform50 homeassistant:51 image: ghcr.io/home-assistant/home-assistant:stable52 container_name: homeassistant53 restart: unless-stopped54 depends_on:55 - mosquitto56 - frigate57 volumes:58 - ./homeassistant/config:/config59 - /etc/localtime:/etc/localtime:ro60 ports:61 - "8123:8123"62 environment:63 - TZ=${TZ:-UTC}6465networks:66 default:67 driver: bridge68EOF6970# 2. Create the .env file71cat > .env << 'EOF'72# Timezone73TZ=Europe/London7475# MQTT Credentials (optional, for secured setup)76MQTT_USER=77MQTT_PASSWORD=7879# Frigate RTSP Password80RTSP_PASSWORD=changeme8182# ============================================83# SETUP INSTRUCTIONS84# ============================================8586# 1. Create Mosquitto config:87# mkdir -p mosquitto/config mosquitto/data mosquitto/log88# cat > mosquitto/config/mosquitto.conf << 'EOF'89# listener 188390# listener 900191# protocol websockets92# allow_anonymous true93# persistence true94# persistence_location /mosquitto/data/95# log_dest file /mosquitto/log/mosquitto.log96# EOF9798# 2. Create Frigate config:99# mkdir -p frigate/config frigate/media100# cat > frigate/config/config.yml << 'EOF'101# mqtt:102# enabled: true103# host: mosquitto104# port: 1883105# topic_prefix: frigate106# client_id: frigate107#108# detectors:109# cpu1:110# type: cpu111#112# cameras:113# front_door:114# ffmpeg:115# inputs:116# - path: rtsp://user:pass@camera-ip:554/stream117# roles:118# - detect119# - record120# detect:121# enabled: true122# width: 1280123# height: 720124# fps: 5125# record:126# enabled: true127# retain:128# days: 7129# snapshots:130# enabled: true131# retain:132# default: 7133# EOF134135# 3. In Home Assistant, add MQTT integration:136# Settings > Devices & Services > Add Integration > MQTT137# Broker: mosquitto (or the container IP)138# Port: 1883139140# 4. Install Frigate integration in HACS or manually:141# Settings > Devices & Services > Add Integration > Frigate142# URL: http://frigate:5000143EOF144145# 3. Start the services146docker compose up -d147148# 4. View logs149docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/frigate-home-assistant-mqtt/run | bashTroubleshooting
- Frigate shows 'Failed to connect to camera' errors: Verify RTSP URLs are accessible and credentials are correct in config.yml
- High CPU usage during AI detection: Enable hardware acceleration by uncommenting GPU device mappings or connecting Coral TPU
- Home Assistant not receiving Frigate events: Check MQTT broker connectivity and ensure Frigate MQTT settings match Mosquitto configuration
- Frigate web UI shows black camera feeds: Verify camera RTSP streams support the codecs specified in Frigate config
- Mosquitto connection refused errors: Ensure mosquitto.conf exists with proper listener configuration before container startup
- Home Assistant Frigate integration fails: Install HACS Frigate integration and configure with correct Frigate URL and MQTT settings
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
frigatehome-assistantmosquittomqtt
Tags
#frigate#home-assistant#mqtt#mosquitto#nvr#smart-home#automation#surveillance
Category
Home Lab & Self-HostingAd Space
Shortcuts: C CopyF FavoriteD Download