published on in blog

How to Use Home Assistant as a Network Video Recorder

If you have wireless IP cameras installed on your premises, or you plan to deploy Wi-Fi cameras to avoid the wiring hassle, you can go for a Network Video Recorder or NVR. Except NVRs, especially wireless ones, come with a hefty price tag.

But if you use the Home Assistant server, you can set it up as an NVR with object detection and record videos only when motion is detected. This helps get you the required footage while saving bandwidth and storage at no extra cost.

Things You Will Need

You will need the following to build an NVR using a Home Assistant server:

Install the Frigate NVR Add-On

Frigate is a Network Video recorder or NVR that works with both wireless and wired IP cameras. By installing the Frigate add-on on Home Assistant, you can run a completely local NVR with real-time AI-based object detection. It triggers automatic recording and captures footage based on the motion detected. It’s much more accurate and reliable than MotionEye when it comes to detecting human and object motion.

Follow these steps to install the Frigate add-on in your Home Assistant server,

  • In your Home Assistant Server, go to HACS > Integration and click Explore & Add Integrations.
  • Search and click on Frigate.
  • Click Download > Download.
  • Go to Developer Tools and click Restart to reboot the Home Assistant Server.
  • Add and Configure Frigate NVR

    After restarting the Home Assistant server, follow these steps to add and configure the Frigate NVR.

  • Go to Settings > Add-ons and click the Add-on Store button.
  • Type “frigate” in the search bar and click on the Frigate option. Do not click on other options, such as Frigate Proxy, Beta, etc.
  • Click Install. This will install the Frigate NVR on your Home Assistant Server.
  • Once Frigate is installed, search and install the File Editor add-on.
  • Start the File Editor add-on and open the web UI of the add-on.
  • Click on the Folder icon and then click the New File icon.
  • Name this new file “frigate.yaml” and click OK.
  • Then click on the frigate.yaml file in the File Editor and paste the following code.
    mqtt:
     host: 192.168.0.100
     port: 1885
     user: mqtt-user
     password: techposts
    cameras:
     TerraceCam: # <------ Name the camera
     ffmpeg:
     inputs:
     - path: rtsp://192.168.0.200/live/ch00_1 # <----- Update for your camera
     roles:
     - rtmp
     rtmp:
     enabled: False # <-- RTMP should be disabled if your stream is not H264
     detect:
     width: 1280 # <---- update for your camera's resolution
     height: 720 # <---- update for your camera's resolution
     fps: 5
     record: # <----- Enable recording
     enabled: True
     snapshots: # <----- Enable snapshots
     enabled: True
     motion:
     mask:
     - 0,720,3,0,427,0,355,162,812,565,783,434,708,244,518,279,918,692,274,230,463,246,642,388,944,720
     GarageCam: # <------ Name the camera
     ffmpeg:
     hwaccel_args: -hwaccel vaapi -hwaccel device /dev/drive/renderrd128 -hwaccel_output_format yuv420p
     inputs:
     - path: rtsp://192.168.0.00:8554/mjpeg/1 # <----- Update for your camera
     roles:
     - rtmp
     rtmp:
     enabled: False # <-- RTMP should be disabled if your stream is not H264
     detect:
     width: 1280 # <---- update for your camera's resolution
     height: 720 # <---- update for your camera's resolution
     fps: 5
     record: # <----- Enable recording
     enabled: False
     snapshots: # <----- Enable snapshots
     enabled: False
     Tapo: # <------ Name the camera
     ffmpeg:
     inputs:
     - path: rtsp://techposts:9716582452@192.168.0.248:554/stream1/1 # <----- Update for your camera
     roles:
     - rtmp
     rtmp:
     enabled: False # <-- RTMP should be disabled if your stream is not H264
     detect:
     width: 1280 # <---- update for your camera's resolution
     height: 720 # <---- update for your camera's resolution
     fps: 5
     record: # <----- Enable recording
     enabled: True
     snapshots: # <----- Enable snapshots
     enabled: True
     motion:
     mask:
     - 0,720,3,0,427,0,355,162,812,565,783,434,708,244,518,279,918,692,274,230,463,246,642,388,944,720
  • Make sure to name the cameras properly and replace the -path: URL with your Wi-Fi-based or wired IP camera’s RTSP or stream URL. You may also change the resolution, and fps, edit the motion mask, etc. Also, update the MQTT host, user, and password details.
  • Once done, click the Save icon.
  • Go back to Settings > Add-ons and click on Frigate.
  • Click Start. If the code in the frigate.yaml is correct and MQTT is working, the Frigate add-on will start successfully.
  • Click Open Web UI. This will display the live stream of all the cameras you have added to the frigate.yaml file.
  • If some cameras are off or not connected to the network, it will show a green screen. As soon as movement is detected, the Frigate starts capturing the video and stores it on the Home Assistant storage under Media > Frigate folder.
  • You can also click on the Events button to view the videos and images captured by Frigate. You can play or download videos or snapshots anytime with just a few clicks.
  • You can also delete the videos and must do it after a month to make space for new videos and snapshots.
  • Smart Surveillance at a Fraction of the Cost

    With Frigate setup in your Home Assistant, you can leverage the AI and object detection capabilities of the add-on to monitor your home, office, and surroundings. You can use any IP camera, and it doesn’t necessarily have to be smart.

    Also, you don’t need any memory card for cameras to store the video footage. Just add your IP cameras to the Frigate add-on running on your Home Assistant server and let the add-on handle the rest for you. It reduces the storage I/O and helps conserve the Home Assistant drive space as it only captures videos when movement is detected.

    ncG1vNJzZmivp6x7rq3KnqysnZ%2Bbe6S7zGifqK9dqbxuwdKeZKGnnZp6or%2FSoqqtmZ6peqK%2FjKetq2WemsG4u9GkZK%2BhlJq8br7EnKarnJWnfA%3D%3D