<linkrel="search"type="application/opensearchdescription+xml"title="Frigate"href="/frigate/opensearch.xml"><titledata-react-helmet="true">Integration with Home Assistant | Frigate</title><metadata-react-helmet="true"name="twitter:card"content="summary_large_image"><metadata-react-helmet="true"name="docsearch:language"content="en"><metadata-react-helmet="true"name="docsearch:version"content="current"><metadata-react-helmet="true"name="docsearch:docusaurus_tag"content="docs-default-current"><metadata-react-helmet="true"property="og:title"content="Integration with Home Assistant | Frigate"><metadata-react-helmet="true"name="description"content="The best way to integrate with Home Assistant is to use the official integration."><metadata-react-helmet="true"property="og:description"content="The best way to integrate with Home Assistant is to use the official integration."><metadata-react-helmet="true"property="og:url"content="https://blakeblackshear.github.io/frigate/usage/home-assistant"><linkdata-react-helmet="true"rel="shortcut icon"href="/frigate/img/favicon.ico"><linkdata-react-helmet="true"rel="preconnect"href="https://BH4D9OD16A-dsn.algolia.net"crossorigin="anonymous"><linkdata-react-helmet="true"rel="canonical"href="https://blakeblackshear.github.io/frigate/usage/home-assistant"><linkrel="stylesheet"href="/frigate/styles.4dd8d972.css">
in your Home Assistant configuration for the Media Browser to appear.</p><h2><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="configuration"></a>Configuration<aclass="hash-link"href="#configuration"title="Direct link to heading">#</a></h2><p>When configuring the integration, you will be asked for the following parameters:</p><table><thead><tr><th>Variable</th><th>Description</th></tr></thead><tbody><tr><td>URL</td><td>The <code>URL</code> of your frigate instance, the URL you use to access Frigate in the browser. This may look like <code>http://<host>:5000/</code>. If you are using HassOS with the addon, the URL should be <code>http://ccab4aaf-frigate:5000</code> (or <code>http://ccab4aaf-frigate-beta:5000</code> if your are using the beta version of the addon). Live streams required port 1935, see <ahref="#streams">RTMP streams</a></td></tr></tbody></table><aname="options"></a>## Options<divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">Home Assistant > Configuration > Integrations > Frigate > Options</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><table><thead><tr><th>Option</th><th>Description</th></tr></thead><tbody><tr><td>RTMP URL Template</td><td>A <ahref="https://jinja.palletsprojects.com/"target="_blank"rel="noopener noreferrer">jinja2</a> 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 <ahref="https://www.home-assistant.io/blog/2019/07/17/release-96/#advanced-mode"target="_blank"rel="noopener noreferrer">advanced mode</a> enabled. See <ahref="#streams">RTMP streams</a> below.</td></tr></tbody></table><h2><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="entities-provided"></a>Entities Provided<aclass="hash-link"href="#entities-provided"title="Direct link to heading">#</a></h2><table><thead><tr><th>Platform</th><th>Description</th></tr></thead><tbody><tr><td><code>camera</code></td><td>Live camera stream (requires RTMP), camera for image of the last detected object.</td></tr><tr><td><code>sensor</code></td><td>States to monitor Frigate performance, object counts for all zones and cameras.</td></tr><tr><td><code>switch</code></td><td>Switch entities to toggle detection, clips and snapshots.</td></tr><tr><td><code>binary_sensor</code></td><td>A "motion" binary sensor entity per camera/zone/object.</td></tr></tbody></table><h2><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="media-browser-support"></a>Media Browser Support<aclass="hash-link"href="#media-browser-support"title="Direct link to heading">#</a></h2><p>The integration provides:</p><ul><li>Rich UI with thumbnails for browsing event clips</li><li>Rich UI for browsing 24/7 recordings by month, day, camera, time</li></ul><p>This is accessible via "Media Browser" on the left menu panel in Home Assistant.</p><aname="api"></a>## API<ul><li>Notification API with public facing endpoints for images in notifications</li></ul><h3><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="notifications"></a>Notifications<aclass="hash-link"href="#notifications"title="Direct link to heading">#</a></h3><p>Frigate 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 <code>before</code> and <code>after</code> information as shown
<ahref="#frigateevents">here</a>. 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):</p><p>To load an image taken by frigate from Home Assistants API see below:</p><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">https://HA_URL/api/frigate/notifications/<event-id>/thumbnail.jpg</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><p>To load a video clip taken by frigate from Home Assistants API :</p><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">https://HA_URL/api/frigate/notifications/<event-id>/<camera>/clip.mp4</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><p>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.</p><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-yaml codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token key atrule">automation</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"></span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">-</span><spanclass="token plain"></span><spanclass="token key atrule">alias</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"> Notify of events</span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token key atrule">trigger</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"></span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token key atrule">platform</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"> mqtt</span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token key atrule">topic</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"> frigate/events</span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token key atrule">action</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"></span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">-</span><spanclass="token plain"></span><spanclass="token key atrule">service</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"> notify.mobile_app_pixel_3</span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token key atrule">data_template</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"></span></div><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain"></span><spanclass="token key atrule">message</span><spanclass="token punctuation"style="color:rgb(199, 146, 234)">:</span><spanclass="token plain"></span><spanclass="token string"style="col
port (default: <code>1935</code>) at <code><frigatehost>:1935</code>. Home Assistant will directly
connect to that streaming port when the live camera is viewed.</p><h4><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="rtmp-url-template"></a>RTMP URL Template<aclass="hash-link"href="#rtmp-url-template"title="Direct link to heading">#</a></h4><p>For advanced usecases, this behavior can be changed with the <ahref="#options">RTMP URL
template</a> option. When set, this string will override the default stream
address that is derived from the default behavior described above. This option supports
<ahref="https://jinja.palletsprojects.com/"target="_blank"rel="noopener noreferrer">jinja2 templates</a> and has the <code>camera</code> dict
variables from <ahref="https://blakeblackshear.github.io/frigate/usage/api#apiconfig"target="_blank"rel="noopener noreferrer">Frigate API</a>
available for the template. Note that no Home Assistant state is available to the
template, only the camera dict from Frigate.</p><p>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).</p><h6><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="rtmp-url-template-examples"></a>RTMP URL Template Examples<aclass="hash-link"href="#rtmp-url-template-examples"title="Direct link to heading">#</a></h6><p>Use a different port number:</p><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">rtmp://<frigate_host>:2000/live/front_door</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><p>Use the camera name in the stream URL:</p><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">rtmp://<frigate_host>:2000/live/{{ name }}</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><p>Use the camera name in the stream URL, converting it to lowercase first:</p><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">rtmp://<frigate_host>:2000/live/{{ name|lower }}</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><h2><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="multiple-instance-support"></a>Multiple Instance Support<aclass="hash-link"href="#multiple-instance-support"title="Direct link to heading">#</a></h2><p>The Frigate integration seamlessly supports the use of multiple Frigate servers. </p><h3><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="requirements-for-multiple-instances"></a>Requirements for Multiple Instances<aclass="hash-link"href="#requirements-for-multiple-instances"title="Direct link to heading">#</a></h3><p>In order for multiple Frigate instances to function correctly, the
<code>topic_prefix</code> and <code>client_id</code> parameters must be set differently per server.
See <ahref="https://blakeblackshear.github.io/frigate/configuration/index#mqtt"target="_blank"rel="noopener noreferrer">MQTT
configuration</a>
for how to set these.</p><h4><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="api-urls"></a>API URLs<aclass="hash-link"href="#api-urls"title="Direct link to heading">#</a></h4><p>When multiple Frigate instances are configured, <ahref="#api">API</a> URLs should include an
identifier to tell Home Assistant which Frigate instance to refer to. The
identifier used is the MQTT <code>client_id</code> paremeter included in the configuration,
and is used like so:</p><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">https://HA_URL/api/frigate/<client-id>/notifications/<event-id>/thumbnail.jpg</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><divclass="mdxCodeBlock_1zKU"><divclass="codeBlockContent_actS"><divtabindex="0"class="prism-code language-undefined codeBlock_tuNs thin-scrollbar"><divclass="codeBlockLines_3uvA"style="color:#bfc7d5;background-color:#292d3e"><divclass="token-line"style="color:#bfc7d5"><spanclass="token plain">https://HA_URL/api/frigate/<client-id>/clips/front_door-1624599978.427826-976jaa.mp4</span></div></div></div><buttontype="button"aria-label="Copy code to clipboard"class="copyButton_2GIj">Copy</button></div></div><h4><aaria-hidden="true"tabindex="-1"class="anchor enhancedAnchor_prK2"id="default-treatment"></a>Default Treatment<aclass="hash-link"href="#default-treatment"title="Direct link to heading">#</a></h4><p>When a single Frigate instance is configured, the <code>client-id</code> parameter need not
be specified in URLs/identifiers -- that single instance is assumed. When
multiple Frigate instances are configured, the user <strong>must</strong> explicitly specify