I've done several videos on NVR software, MotionEyeOS, Shinobi, etc.  But what I've been really looking for is an NVR that could put the use of my cameras to work for me.  

Frigate NVR does just that. I allows me to feed it an RTSP stream, setup object (person in my case) detection, and trigger automations off of those detected motion events.  I have a Reolink camera on my driveway, and it has motion detection, and scheduling, which are nice, but my wire's 12 ft sunflowers set it off constnatly because it just does "dumb" motion detection.  

Frigate, on the other hand, allows me to specify that I only want triggers to happen based on motion and detection of speific object types.  That is where it really starts to beat out the rest of the offerings for me.

What we'll need

We need a few things setup on our Home Assistant install in order to get the full use out of Frigate.

Tools / Add-ons

  • File Editor (or samba shares if you prefer)
  • MQTT (I'll be using Mosquittto Broker)
  • Frigate NVR (stable, but feel free to try the Beta if you like)
  • Terminal / SSH

Integrations

  • HACS (Home Assistant Community Store)
  • Frigate integration via HACS

Setup and Install the Frigate Add-On

First, we'll need a way to edit files in our Home Assistant setup, so if you don't already have it, go to Supervisor >> Add-ons, and find the "File Editor" add-on and click "Install".  

Once it downloads and installs, click "start" to start the add-on.  Feel free to check the box to put it in the sidebar as well.

Next, we need MQTT (message queueing).  We'll use the Mosquitto broker for this.  Again in the Add-on store, search for Mosquitto, and install it.  Start it once installed, and then we'll need to configure it from the Integrations page.

First, let's add an MQTT user.  Go to Configuration >> People, and click the Add button in the lower right.  In the window that comes up add an mqtt username (I used testmqtt for mine).  Next, click the option to allow the user to login, then give the user a strong password.  Don't make the user an admin.  Click 'Create', then click 'Create' one more time, and your new MQTT user is ready.

Once MQTT is installed and running, let's check out the Integrations page.  Go to Configuration >> Integrations.  Find MQTT, and click 'Configure'.  Now find the MQTT integration in the bottom of the list, and click 'Configure' again.   In the new view, click on the "Re-configure MQTT" option.  In the pop-up, leave the Broker and Ports alone, but change the username and password to match the user you created above. Click on 'Submit' until you are back at the MQTT Settings screen.

You can now test MQTT to see that it's working.   In the "Topic to subscribe to" field, enter /my/test/ anc click the "Start Listening" button.

Above that, in the "Topic" field enter /my/test/ and in the data field (with a 1 in front of it) enter "my-test-info".  Click "Publish" and you should see some data show up near the bottom.  If so, everything is setup, and you are ready to move forward.

Install Frigate NVR Add-on

Go to https://blakeblackshear.github.io/frigate/ and then click on the Installation option in the left menu.  Under the Hass Addon section, copy the link from #2, and go back into Home Assistant.  Navigate to Supervisor >> Addons, and click the 3 dots in the upper right corner of the screen.

Select to add a custom repository.  Paste in the link you just copied, then click Add.  You should see Frigate displayed in the window, and you can close it.

To see Frigate show up on the Addons page, you may need to refresh.  Use CTRL+F5 or CMD+F5 for Mac, and then you should see it.

Click on Frigate NVR, (i'm not using the Beta).  Click 'Install', and let it run.  While it's installing we need to create a configuration file for Frigate to use.

Go to the Fiel Editor, and click the folder at the top left to open the sidebar in File Editor.  Click 'New File' at the top, and call it "frigate.yml".

Now close the modal, and go to the frigate.yml file you just created.

Paste the following into that file, and change the fields with < > around them to match your information.

mqtt:
  host: homeassistant.local
  user: < your mqtt user >
  password: < your mqtt password >
 
cameras:
  pi_cam_1:
    ffmpeg:
      inputs:
        - path: < your camera rtsp stream url >
          roles:
            - detect   # only if you want object detection
            - clips    # only if you want to record video and stills
    width: < your camera resolution width >     # e.g. 1280
    height: < your camera resolution height >   # e.g. 720
    fps: 5
    objects:
      track:       # add more object types under this if you want
        - person   # only if you want to detect persons
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 2
    clips:
      enabled: true
      retain:
        default: 2
  pi_cam_2:      # remove this section if you only have 1 camera
    ffmpeg:
      inputs:
        - path: < your camera rtsp stream url >
          roles:
            - detect     # only if you want object detection
            - clips      # only if you want to record video and stills
    width: < your camera resolution width >     # e.g. 1280
    height: < your camera resolution height >   # e.g. 720
    fps: 5
    objects:
      track:        # add more object types under this if you want
        - person    # only if you want to detect persons
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 2
    clips:
      enabled: true
      retain:
        default: 2
    
detectors:    # not needed if you are using google coral stick
  cpu1:
    type: cpu

After adding the info above, and removing comments and replacing any field with the < > around it, then click the save button.  Remembeer, yaml code is space sensitive, so be very careful not to mess with the spacing.

Now, head back over to Supervisor >> Addons, and click Frigate again.  Click 'Start' and give it a few seconds.  jump over to the Logs view, and make sure you don't see any errors.  If you do see errors, you'll have to check your config again, then repeat until you get no errors.

Once it's up and running, you should be able to open the frigate UI and see your camera stream (a still image on the main page, but click on it to see the camera feed).

Below the feed, you can click to see more options, and from there toggle on motion detection (general), and bounding box, and more. Give it a test, and make sure it all seems to be working.  Keep in mind these settings in the UI are temporary and will be lost when you restart ha or Frigate.   It's better to ensure you have the options you want set in the configuration file.

Install the Integration

Now we want to install the Frigate Integration through HACS, which means you need to have HACS setup as well.

Depending on how you run Home Assistant, you'll setup HACS in one of several ways, so it's important to know which HA you run.  You can find this by going to Configuration >> General >> Info.  Look for the Install Type and make note of it.

Now go to https://hacs.xyz/docs/installation/installation/ and follow their guids on how to get HACS installed in your Home Assistant.

For me, running HassOS, I installed the Terminal / SSH add on, then set a password in the configuration for that add on, and made sure port 22 was set. Opened the Web Shell (super convenient), and ran the following script to install HACS:

wget -q -O - https://install.hacs.xyz | bash -

Once it was done, I went ahead and Rebooted my entire home Assistant server.  Go to Supervisor >> System, and click 'Reboot Host', then confirm.

Once HA is back up, you should now be able to add the HACS integration by going to Configuration  >> Integrations, and clicking the Add button int he bottom right, then searching for HACS.  

Follow the guide on screen, and use your github account to generate an application token.   Apply it according to the HACS wizard and documentation, and we are ready to get the Frigate integration installed.

NOTE:  After setting up HACS, you may have to wait for a couple of hours for the Github rate limit to allow you to use HACS fully.  Be patient.

Again, open the HACS integration from the left pane, and then click on Integrations in that page.  Click the three dots in the upper right, and select "Custom Repositories".

Paste in the Frigate Home Assistant Integration repository url:

https://github.com/blakeblackshear/frigate-hass-integration

and click "submit".

You should now be able to go to Configuration >> Integrations, and add the Frigate Integration to Home Assistant.  This integration will give you all kinds of entities and devices to use for scenes, automations, scripts, and so much more.  

Now, you can make sue of the Home Assistant Frigate NVR add on and start making your home even smarter and more safe.