Integration with Home Assistant
The best way to integrate with Home Assistant is to use the official integration.
#
InstallationAvailable via HACS as a custom repository. To install:
- Add the custom repository:
Key | Value |
---|---|
Repository URL | https://github.com/blakeblackshear/frigate-hass-integration |
Category | Integration |
- Use HACS to install the integration:
- Restart Home Assistant.
- Then add/configure the integration:
Note: You will also need media_source enabled in your Home Assistant configuration for the Media Browser to appear.
#
ConfigurationWhen configuring the integration, you will be asked for the following parameters:
Variable | Description |
---|---|
URL | The URL of your frigate instance, the URL you use to access Frigate in the browser. This may look like http://<host>:5000/ . If you are using HassOS with the addon, the URL should be http://ccab4aaf-frigate:5000 (or http://ccab4aaf-frigate-beta:5000 if your are using the beta version of the addon). Live streams required port 1935, see RTMP streams |
Option | Description |
---|---|
RTMP URL Template | A jinja2 template that is used to override the standard RTMP stream URL (e.g. for use with reverse proxies). This option is only shown to users who have advanced mode enabled. See RTMP streams below. |
#
Entities ProvidedPlatform | Description |
---|---|
camera | Live camera stream (requires RTMP), camera for image of the last detected object. |
sensor | States to monitor Frigate performance, object counts for all zones and cameras. |
switch | Switch entities to toggle detection, clips and snapshots. |
binary_sensor | A "motion" binary sensor entity per camera/zone/object. |
#
Media Browser SupportThe integration provides:
- Rich UI with thumbnails for browsing event clips
- Rich UI for browsing 24/7 recordings by month, day, camera, time
This is accessible via "Media Browser" on the left menu panel in Home Assistant.
## API- Notification API with public facing endpoints for images in notifications
#
NotificationsFrigate publishes event information in the form of a change feed via MQTT. This
allows lots of customization for notifications to meet your needs. Event changes
are published with before
and after
information as shown
here. Note that some people may not want to expose frigate to
the web, so you can leverage the HA API that frigate custom_integration ties
into (which is exposed to the web, and thus can be used for mobile notifications
etc):
To load an image taken by frigate from Home Assistants API see below:
To load a video clip taken by frigate from Home Assistants API :
Here is a simple example of a notification automation of events which will update the existing notification for each change. This means the image you see in the notification will update as frigate finds a "better" image.
If you are using telegram, you can fetch the image directly from Frigate:
In order for the live streams to function they need to be accessible on the RTMP
port (default: 1935
) at <frigatehost>:1935
. Home Assistant will directly
connect to that streaming port when the live camera is viewed.
#
RTMP URL TemplateFor advanced usecases, this behavior can be changed with the RTMP URL
template option. When set, this string will override the default stream
address that is derived from the default behavior described above. This option supports
jinja2 templates and has the camera
dict
variables from Frigate API
available for the template. Note that no Home Assistant state is available to the
template, only the camera dict from Frigate.
This is potentially useful when Frigate is behind a reverse proxy, and/or when the default stream port is otherwise not accessible to Home Assistant (e.g. firewall rules).
#
RTMP URL Template ExamplesUse a different port number:
Use the camera name in the stream URL:
Use the camera name in the stream URL, converting it to lowercase first:
#
Multiple Instance SupportThe Frigate integration seamlessly supports the use of multiple Frigate servers.
#
Requirements for Multiple InstancesIn order for multiple Frigate instances to function correctly, the
topic_prefix
and client_id
parameters must be set differently per server.
See MQTT
configuration
for how to set these.
#
API URLsWhen multiple Frigate instances are configured, API URLs should include an
identifier to tell Home Assistant which Frigate instance to refer to. The
identifier used is the MQTT client_id
paremeter included in the configuration,
and is used like so:
#
Default TreatmentWhen a single Frigate instance is configured, the client-id
parameter need not
be specified in URLs/identifiers -- that single instance is assumed. When
multiple Frigate instances are configured, the user must explicitly specify
which server they are referring to.