This guide will teach you how to integrate or add a Wi-Fi-based CCTV camera to Home Assistant and use it as a network video recorder (NVR) to store the captured footage.

Adding Wi-Fi Security Camera to Home Assistant

First things first; what is Home Assistant exactly, and what can you do with it?

Home Assistant is a free and open-source home automation software that you can deploy on a Raspberry Pi or old laptop to build a localized and completely private smart home. It supports over 1900 devices and services, allowing you to integrate and control smart devices from various manufacturers or developers.

With Home Assistant, you can add and control single or multiple Wi-Fi or IP cameras from various manufacturers in one dashboard. Thus, you don’t need to install and use different apps to access or monitor your security cameras.

Step 1: Find the Camera RTSP Stream URL

Every IP or Wi-Fi-based security camera has a stream URL that you can add to Home Assistant to view the live stream without having to sign up or using any third-party cloud services.

You can find the HTTP stream URL for Motion JPEG cameras or RTSP stream for H.264 cameras in their apps.

However, in some generic CCTV cameras—for example, cameras that use the V360 Pro app—you need to enable the RTSP stream by flashing a code via an SD card.

The following table lists popular Wi-Fi CCTV camera models with their URLs. You must replace the part in the stream URL.

You can get the camera’s IP from your router DHCP settings or use the Fing app (network scanner) on your Android or iOS smartphone to discover the Wi-Fi CCTV cameras connected to your network.

Once you have the IP, use the table to edit the IP address and keep the port 554 (default for RTSP). To check if the stream is working, open the VLC player and click Media > Open Network Stream.

Paste the RTSP stream URL and click Play.

The VLC should start displaying the live camera feed.

Step 2: Install Frigate NVR Add-On

Frigate is an open-source NVR that you can install as an add-on in Home Assistant for real-time AI object detection, recording videos, or taking snapshots based on events. All feeds are processed within your local system to detect motion, person, or object. Thus, it’s completely private and secure.

Once you have the RTSP stream URL, install the Frigate add-on by following the below instructions:

In the Home Assistant (HA), go to Settings > Add-Ons and click the ADD-ON STORE button. Click the three dots at the top right and choose Repositories. Paste the link—https://github. com/blakeblackshear/frigate-hass-addons and click Add. Then click on the Frigate NVR in the add-ons section and click Install. This can take a while to complete. Once the installation is complete, open the File Editor add-on. Create a new file called frigate. yaml, paste the following code, and click Save. mqtt: host: 192. xxx. xx. xx user: password: cameras: TerraceCam: # <—— Name the camera ffmpeg: inputs: - path: rtsp://YourRTSPStreamURL # <—– Update for your camera roles: - detect - 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: 24 record: # <—– Enable recording enabled: True motion: mask: - 0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375,866,432 Go back to add-ons and start Frigate. Make sure to enable Start on boot and Show in the sidebar. Click on the OPEN WEB UI or Frigate in the sidebar to open and access the camera view. You can enable Motion detection to record clips and snapshots when motion is detected. When there’s movement or a person shows up, a video event is recorded and saved, which you can access whenever.

Note that Frigate records an event with the date and timestamp for future reference.

Step 3: Edit Motion Mask

To avoid false motion detection, you can mask the area where you want to detect motion by following these steps.

Go to Frigate Web UI and click on the camera feed. Click Debug and then click Show Options. Click Mask and Zone Creator. Create a mask by moving the black dots on the screen. Then copy the Motion Masks values. Open the File Editor and enter the copied mask values in the frigate. yaml file. Click Save and restart the Frigate add-on for the changes to take effect.

If you are using a Raspberry Pi for Home Assistant, you may run out of storage space after some time as events are recorded. You can increase the storage and performance of Raspberry Pi by installing Home Assistant and booting Raspberry Pi via SSD instead of the micro SD card.​​​​​​​

DIY NVR With Continuous or Motion-Based Recording

As you can see, with the help of Home Assistant and Frigate add-on, you can add any Wi-Fi-based CCTV camera and secure your home or office with automatic event-based recording. You may also enable continuous recording for 24x7 footage.

However, that will require more storage. Nonetheless, all the footage and recordings are processed and saved locally on your system drive. Alternatively, you may also use the MotionEye NVR add-on in Home Assistant to add Wi-Fi cameras for motion-based recordings and snapshots.