Get alerts for Frigate events with snapshots and filters.
This project has been split off from the now deprecated dlford/frigate-slack-alerts
,
in the future I will be adding support for Gotify, and
potentially other platforms down the road for push notifications.
frigate
)_metadata:
major_version: 1
minor_version: 1
display_information:
name: frigate-bot
description: Frigate alerts bot
background_color: '#232c34'
features:
bot_user:
display_name: FrigateBot
always_online: true
app_home:
home_tab_enabled: false
messages_tab_enabled: true
messages_tab_read_only_enabled: true
oauth_config:
scopes:
bot:
- app_mentions:read
- channels:history
- channels:join
- channels:manage
- channels:read
- chat:write.customize
- chat:write.public
- chat:write
- files:read
- files:write
- groups:history
- groups:read
- groups:write
- im:history
- im:read
- im:write
- links:read
- links:write
- mpim:history
- mpim:read
- mpim:write
- pins:read
- pins:write
- reactions:read
- reactions:write
- reminders:read
- reminders:write
- team:read
- usergroups:read
- usergroups:write
- users:read
- users:write
- users.profile:read
settings:
event_subscriptions:
bot_events:
- app_mention
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
/data/mqtt/password.txt
in this example)
touch /data/mqtt/password.txt
# User for frigate
mosquitto_passwd /data/mqtt/password.txt frigate
# User for alerts
mosquitto_passwd /data/mqtt/password.txt alerts
/data/mqtt/config/mosquitto.conf
in this example)
allow_anonymous false
password_file /mosquitto/config/password.txt
# MQTT
listener 1883 0.0.0.0
protocol mqtt
version: '3.9'
services:
mqtt:
container_name: mqtt
restart: unless-stopped
image: eclipse-mosquitto
volumes:
- '/data/mqtt/config/mosquitto.conf:/mosquitto/config/mosquitto.conf'
- '/data/mqtt/password.txt:/mosquitto/config/password.txt'
alerts:
container_name: alerts
restart: unless-stopped
image: ghcr.io/dlford/frigate-alerts:latest
environment:
FSA_MQTT_BROKER: mqtt
FSA_MQTT_USER: alerts
FSA_MQTT_PASSWORD: 'ChangeMe123'
FSA_FRIGATE_INTERNAL_BASEURL: http://frigate:5000
FSA_FRIGATE_EXTERNAL_BASEURL: 'https://frigate.yourdomain.com'
FSA_SLACK_TOKEN: 'Your_Slack_OAuth_API_Token'
# Right click a channel in Slack and choose "View channel details",
# the ID will be at the bottom of that pane
FSA_SLACK_CHANNEL_ID: 'Your_Slack_Channel_ID'
frigate:
# ... See https://docs.frigate.video/frigate/installation
# See https://docs.frigate.video/configuration/
mqtt:
enabled: True
host: mqtt
port: 1883
user: frigate
password: ChangeMe123
The following environment variables can be added to the environment
section of docker-compose.yml
:
FSA_MQTT_BROKER
: Hostname of MQTT brokerFSA_MQTT_PORT
: Port of MQTT brokerFSA_MQTT_USER
: Username for MQTT brokerFSA_MQTT_PASSWORD
: Password for MQTT brokerFSA_MQTT_CLIENT_ID
: Client ID for MQTT broker, default is go-frigate-slack-alerts
FSA_FRIGATE_TOPIC_PREFIX
: MQTT topic prefix of Frigate, default is frigate
FSA_FRIGATE_INTERNAL_BASEURL
: HTTP path to Frigate container, used for fetching snapshot imagesFSA_FRIGATE_EXTERNAL_BASEURL
: HTTP path to Frigate from the user end, you can use the IP address of your host if you don't have external accessFSA_SLACK_TOKEN
: Slack OAuth API Token for your Slack AppFSA_SLACK_CHANNEL_ID
: Slack Channel ID to send alerts to (Slack App must be added to this channel)FSA_FILTER_CONFIG_FILE
: Path to a filters config file, see below. This file must be mounted as a volume to the alerts containerFSA_IGNORE_EVENTS_WITHOUT_SNAPSHOT
: Boolean, skips alerts for events that don't have a snapshot image if set to true
, default is false
You may want to have some events recorded but not send alerts, this is possible with event filters. By default, all event alerts are sent to Slack, but if you add a filters file, only events described in the filters will be sent to Slack.
filters.yml
file (/data/alerts.filters.yml
in this example)
# Cameras not included in this list will not be alerted
cameras:
- name: camera1
# Zones not included in this list will not be alerted for this camera
zones:
- name: zone1
# Objects not included in this list will not be alerted for this zone
objects:
- person
- dog
version: '3.9'
services:
mqtt:
# ...
alerts:
# ...
volumes:
- '/data/alerts/filters.yml:/app/filters.yml'
# ...
FSA_FILTER_CONFIG_FILE
environment variable
version: '3.9'
services:
mqtt:
# ...
alerts:
# ...
volumes:
- '/data/alerts/filters.yml:/app/filters.yml'
environment:
FSA_FILTER_CONFIG_FILE: /app/filters.yml
# ...