2021-01-21 03:26:49 +03:00
---
id: home-assistant
2021-09-14 06:02:12 +03:00
title: Home Assistant Integration
2021-01-21 03:26:49 +03:00
---
2021-06-26 23:52:46 +03:00
The best way to integrate with Home Assistant is to use the [official integration ](https://github.com/blakeblackshear/frigate-hass-integration ).
2021-01-21 03:26:49 +03:00
2021-06-26 23:52:46 +03:00
## Installation
2021-01-21 03:26:49 +03:00
2021-09-05 18:42:38 +03:00
### Preparation
2021-01-21 03:26:49 +03:00
2021-09-05 18:42:38 +03:00
The Frigate integration requires the `mqtt` integration to be installed and
manually configured first.
2021-01-21 03:26:49 +03:00
2021-09-05 18:42:38 +03:00
See the [MQTT integration
documentation](https://www.home-assistant.io/integrations/mqtt/) for more
details.
2023-03-16 01:43:36 +03:00
In addition, MQTT must be enabled in your Frigate configuration file and Frigate must be connected to the same MQTT server as Home Assistant for many of the entities created by the integration to function.
2021-09-05 18:42:38 +03:00
### Integration installation
2021-06-26 23:52:46 +03:00
2021-09-05 18:42:38 +03:00
Available via HACS as a default repository. To install:
2021-06-26 23:52:46 +03:00
2021-08-06 10:13:20 +03:00
- Use [HACS ](https://hacs.xyz/ ) to install the integration:
2021-06-26 23:52:46 +03:00
```
2024-08-17 15:14:45 +03:00
Home Assistant > HACS > Click in the Search bar and type "Frigate" > Frigate
2021-06-26 23:52:46 +03:00
```
2021-08-06 10:13:20 +03:00
- Restart Home Assistant.
- Then add/configure the integration:
2021-06-26 23:52:46 +03:00
```
2023-03-23 03:47:13 +03:00
Home Assistant > Settings > Devices & Services > Add Integration > Frigate
2021-06-26 23:52:46 +03:00
```
Note: You will also need
[media_source ](https://www.home-assistant.io/integrations/media_source/ ) enabled
in your Home Assistant configuration for the Media Browser to appear.
2021-09-05 18:42:38 +03:00
### (Optional) Lovelace Card Installation
To install the optional companion Lovelace card, please see the [separate
installation instructions](https://github.com/dermotduffy/frigate-hass-card) for
that card.
2021-06-26 23:52:46 +03:00
## Configuration
2025-01-13 17:50:44 +03:00
When configuring the integration, you will be asked for the `URL` of your Frigate instance which can be pointed at the internal unauthenticated port (`5000`) or the authenticated port (`8971`) for your instance. This may look like `http://<host>:5000/` .
2024-05-18 19:36:13 +03:00
### Docker Compose Examples
2025-03-24 17:05:59 +03:00
If you are running Home Assistant and Frigate with Docker Compose on the same device, here are some examples.
2024-05-18 19:36:13 +03:00
#### Home Assistant running with host networking
2025-01-13 17:50:44 +03:00
It is not recommended to run Frigate in host networking mode. In this example, you would use `http://172.17.0.1:5000` or `http://172.17.0.1:8971` when configuring the integration.
2024-05-18 19:36:13 +03:00
```yaml
services:
homeassistant:
image: ghcr.io/home-assistant/home-assistant:stable
network_mode: host
...
frigate:
image: ghcr.io/blakeblackshear/frigate:stable
...
ports:
- "172.17.0.1:5000:5000"
...
```
#### Home Assistant _not_ running with host networking or in a separate compose file
2025-01-13 17:50:44 +03:00
In this example, it is recommended to connect to the authenticated port, for example, `http://frigate:8971` when configuring the integration. There is no need to map the port for the Frigate container.
2024-05-18 19:36:13 +03:00
```yaml
services:
homeassistant:
image: ghcr.io/home-assistant/home-assistant:stable
# network_mode: host
...
frigate:
image: ghcr.io/blakeblackshear/frigate:stable
...
ports:
# - "172.17.0.1:5000:5000"
...
```
2025-03-24 17:05:59 +03:00
### Home Assistant Add-on
2024-05-18 19:36:13 +03:00
2025-03-24 17:05:59 +03:00
If you are using Home Assistant Add-on, the URL should be one of the following depending on which Add-on variant you are using. Note that if you are using the Proxy Add-on, you should NOT point the integration at the proxy URL. Just enter the same URL used to access Frigate directly from your network.
2022-02-06 22:56:09 +03:00
2025-03-24 17:05:59 +03:00
| Add-on Variant | URL |
| -------------------------- | ----------------------------------------- |
| Frigate | `http://ccab4aaf-frigate:5000` |
| Frigate (Full Access) | `http://ccab4aaf-frigate-fa:5000` |
| Frigate Beta | `http://ccab4aaf-frigate-beta:5000` |
| Frigate Beta (Full Access) | `http://ccab4aaf-frigate-fa-beta:5000` |
2021-06-26 23:52:46 +03:00
2024-05-18 19:36:13 +03:00
### Frigate running on a separate machine
2025-01-13 17:50:44 +03:00
If you run Frigate on a separate device within your local network, Home Assistant will need access to port 8971.
2024-05-18 19:36:13 +03:00
#### Local network
2025-01-13 17:50:44 +03:00
Use `http://<frigate_device_ip>:8971` as the URL for the integration so that authentication is required.
2024-05-18 19:36:13 +03:00
2025-02-09 20:04:24 +03:00
:::tip
The above URL assumes you have [disabled TLS ](../configuration/tls ).
By default, TLS is enabled and Frigate will be using a self-signed certificate. HomeAssistant will fail to connect HTTPS to port 8971 since it fails to verify the self-signed certificate.
Either disable TLS and use HTTP from HomeAssistant, or configure Frigate to be acessible with a valid certificate.
:::
2024-05-18 19:36:13 +03:00
```yaml
services:
frigate:
image: ghcr.io/blakeblackshear/frigate:stable
...
ports:
2025-01-13 17:50:44 +03:00
- "8971:8971"
2024-05-18 19:36:13 +03:00
...
```
#### Tailscale or other private networking
Use `http://<frigate_device_tailscale_ip>:5000` as the URL for the integration.
```yaml
services:
frigate:
image: ghcr.io/blakeblackshear/frigate:stable
...
ports:
- "< tailscale_ip > :5000:5000"
...
```
2021-08-06 10:13:20 +03:00
2021-06-26 23:52:46 +03:00
## Options
```
Home Assistant > Configuration > Integrations > Frigate > Options
```
2024-03-05 16:00:27 +03:00
| Option | Description |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| RTSP URL Template | A [jinja2 ](https://jinja.palletsprojects.com/ ) template that is used to override the standard RTSP stream URL (e.g. for use with reverse proxies). This option is only shown to users who have [advanced mode ](https://www.home-assistant.io/blog/2019/07/17/release-96/#advanced-mode ) enabled. See [RTSP streams ](#rtsp-stream ) below. |
2021-06-26 23:52:46 +03:00
## Entities Provided
2024-09-12 03:53:58 +03:00
| Platform | Description |
| --------------- | ------------------------------------------------------------------------------- |
| `camera` | Live camera stream (requires RTSP). |
| `image` | Image of the latest detected object for each camera. |
| `sensor` | States to monitor Frigate performance, object counts for all zones and cameras. |
| `switch` | Switch entities to toggle detection, recordings and snapshots. |
| `binary_sensor` | A "motion" binary sensor entity per camera/zone/object. |
2021-06-26 23:52:46 +03:00
## Media Browser Support
The integration provides:
2021-01-21 03:26:49 +03:00
2024-09-12 03:53:58 +03:00
- Browsing tracked object recordings with thumbnails
2021-09-14 06:02:12 +03:00
- Browsing snapshots
- Browsing recordings by month, day, camera, time
2021-01-21 03:26:49 +03:00
2021-06-26 23:52:46 +03:00
This is accessible via "Media Browser" on the left menu panel in Home Assistant.
2022-05-02 18:22:37 +03:00
## Casting Clips To Media Devices
2022-05-02 18:24:31 +03:00
The integration supports casting clips and camera streams to supported media devices.
2022-05-02 18:22:37 +03:00
2022-05-02 18:39:57 +03:00
:::tip
2022-12-18 02:57:18 +03:00
For clips to be castable to media devices, audio is required and may need to be [enabled for recordings ](../troubleshooting/faqs.md#audio-in-recordings ).
2022-05-02 18:39:57 +03:00
**NOTE: Even if you camera does not support audio, audio will need to be enabled for Casting to be accepted.**
:::
2022-05-02 18:22:37 +03:00
2021-06-26 23:52:46 +03:00
< a name = "api" > < / a >
2021-08-06 10:13:20 +03:00
2025-09-08 15:43:04 +03:00
## Camera API
To disable a camera dynamically
```
action: camera.turn_off
data: {}
target:
entity_id: camera.back_deck_cam # your Frigate camera entity ID
```
To enable a camera that has been disabled dynamically
```
action: camera.turn_on
data: {}
target:
entity_id: camera.back_deck_cam # your Frigate camera entity ID
```
2021-09-14 06:02:12 +03:00
## Notification API
2021-01-21 03:26:49 +03:00
2021-09-14 06:02:12 +03:00
Many people do not want to expose Frigate to the web, so the integration creates some public API endpoints that can be used for notifications.
2021-01-21 03:26:49 +03:00
2024-09-12 03:53:58 +03:00
To load a thumbnail for a tracked object:
2021-05-19 07:08:41 +03:00
```
2021-02-10 22:38:15 +03:00
https://HA_URL/api/frigate/notifications/< event-id > /thumbnail.jpg
```
2024-09-12 03:53:58 +03:00
To load a snapshot for a tracked object:
2021-02-10 22:38:15 +03:00
2021-01-21 03:26:49 +03:00
```
2021-09-14 06:02:12 +03:00
https://HA_URL/api/frigate/notifications/< event-id > /snapshot.jpg
2021-01-21 03:26:49 +03:00
```
2025-01-13 17:50:44 +03:00
To load a video clip of a tracked object using an Android device:
2021-01-21 03:26:49 +03:00
```
2021-09-14 06:02:12 +03:00
https://HA_URL/api/frigate/notifications/< event-id > /clip.mp4
2021-01-21 03:26:49 +03:00
```
2021-06-26 23:52:46 +03:00
2025-01-13 17:50:44 +03:00
To load a video clip of a tracked object using an iOS device:
```
https://HA_URL/api/frigate/notifications/< event-id > /master.m3u8
```
To load a preview gif of a tracked object:
```
https://HA_URL/api/frigate/notifications/< event-id > /event_preview.gif
```
To load a preview gif of a review item:
```
https://HA_URL/api/frigate/notifications/< review-id > /review_preview.gif
```
2021-06-26 23:52:46 +03:00
< a name = "streams" > < / a >
2021-08-06 10:13:20 +03:00
2023-01-13 16:20:25 +03:00
## RTSP stream
In order for the live streams to function they need to be accessible on the RTSP
port (default: `8554` ) at `<frigatehost>:8554` . Home Assistant will directly
2021-06-26 23:52:46 +03:00
connect to that streaming port when the live camera is viewed.
2023-01-13 16:20:25 +03:00
#### RTSP URL Template
2021-06-26 23:52:46 +03:00
2023-01-13 16:20:25 +03:00
For advanced usecases, this behavior can be changed with the [RTSP URL
2021-06-26 23:52:46 +03:00
template](#options) 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 ](https://jinja.palletsprojects.com/ ) and has the `camera` dict
2024-10-07 23:27:35 +03:00
variables from [Frigate API ](../integrations/api )
2021-06-26 23:52:46 +03:00
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).
2023-01-13 16:20:25 +03:00
###### RTSP URL Template Examples
2021-06-26 23:52:46 +03:00
Use a different port number:
```
2023-01-13 16:20:25 +03:00
rtsp://< frigate_host > :2000/front_door
2021-06-26 23:52:46 +03:00
```
Use the camera name in the stream URL:
```
2023-01-13 16:20:25 +03:00
rtsp://< frigate_host > :2000/{{ name }}
2021-06-26 23:52:46 +03:00
```
Use the camera name in the stream URL, converting it to lowercase first:
```
2023-01-13 16:20:25 +03:00
rtsp://< frigate_host > :2000/{{ name|lower }}
2021-06-26 23:52:46 +03:00
```
## Multiple Instance Support
2021-08-06 10:13:20 +03:00
The Frigate integration seamlessly supports the use of multiple Frigate servers.
2021-06-26 23:52:46 +03:00
### Requirements for Multiple Instances
In order for multiple Frigate instances to function correctly, the
`topic_prefix` and `client_id` parameters must be set differently per server.
See [MQTT
2023-11-18 17:04:43 +03:00
configuration](mqtt)
2021-06-26 23:52:46 +03:00
for how to set these.
#### API URLs
2024-03-05 16:00:27 +03:00
When multiple Frigate instances are configured, [API ](#notification-api ) URLs should include an
2021-06-26 23:52:46 +03:00
identifier to tell Home Assistant which Frigate instance to refer to. The
2022-10-05 14:15:15 +03:00
identifier used is the MQTT `client_id` parameter included in the configuration,
2021-06-26 23:52:46 +03:00
and is used like so:
```
https://HA_URL/api/frigate/< client-id > /notifications/< event-id > /thumbnail.jpg
```
```
https://HA_URL/api/frigate/< client-id > /clips/front_door-1624599978.427826-976jaa.mp4
```
#### Default Treatment
When 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
2021-08-14 15:27:43 +03:00
which server they are referring to.
## FAQ
2021-09-14 06:02:12 +03:00
#### If I am detecting multiple objects, how do I assign the correct `binary_sensor` to the camera in HomeKit?
2021-08-14 15:27:43 +03:00
The [HomeKit integration ](https://www.home-assistant.io/integrations/homekit/ ) randomly links one of the binary sensors (motion sensor entities) grouped with the camera device in Home Assistant. You can specify a `linked_motion_sensor` in the Home Assistant [HomeKit configuration ](https://www.home-assistant.io/integrations/homekit/#linked_motion_sensor ) for each camera.
2025-02-05 18:56:16 +03:00
#### I have set up automations based on the occupancy sensors. Sometimes the automation runs because the sensors are turned on, but then I look at Frigate I can't find the object that triggered the sensor. Is this a bug?
No. The occupancy sensors have fewer checks in place because they are often used for things like turning the lights on where latency needs to be as low as possible. So false positives can sometimes trigger these sensors. If you want false positive filtering, you should use an mqtt sensor on the `frigate/events` or `frigate/reviews` topic.