How to Add and Control Wi-Fi CCTV Camera in Home Assistant

You can integrate, control and monitor your generic or branded Wi-Fi CCTV cameras from brands like TP-Link, Ezviz, etc., in Home Assistant without using their cloud services.

Plus, you can enable automation to receive notifications on your smartphone with snapshots or stream a live stream directly to your Amazon Echo Show or Fire TV when motion is detected.

This guide will teach you how to integrate or add a Wi-Fi CCTV camera to Home Assistant and use it as a Network Video Recorder (NVR) to store captured footage.

Add Wi-Fi Security Camera to Home Assistant

First of all; What exactly is Home Assistant and what can you do with it?

Home Assistant is free, open-source home automation software you can deploy on a Raspberry Pi or older laptop to create a localized, 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 one or more Wi-Fi or IP cameras from different manufacturers in a single dashboard. So you don’t need to install and use different apps to access or monitor your security cameras.

Step 1: Find the camera’s RTSP stream URL

Each IP or Wi-Fi security camera has a stream URL that you can add to Home Assistant to view the live stream without having to register or use third-party cloud services.

You can find the HTTP Feed URL for Motion JPEG cameras or RTSP flow for H.264 cameras in their applications.

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 need to replace the part in the feed URL.

Seller URLs
Dahua rtsp://username:[email protected]/cam/realmonitor?channel=1&subtype=0
TP-Link (Tapo) rtsp://username:[email protected]/videoMain
V360 Pro rtsp:///live/ch00_0
Ezviz rtsp://username:[email protected]/H264
Reolink rtsp://admin:[email protected]//h264Preview_01_main
Foscam rtsp://username:[email protected]/videoMain
Hikvision rtsp:///Broadcast/Channels/101

Feed URLs may vary depending on specific or newer models introduced by manufacturers. You can refer to the user manual that came with the camera or the manufacturer’s website to learn more about how to find the RTSP stream URL for that particular model.

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

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

Paste the RTSP stream URL and click To play.

The VLC should start showing the live camera feed.

Step 2: Install the 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, video recording or event-based snapshot taking. All streams are processed in your local system to detect motion, person or object. Thus, it is completely private and secure.

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

  1. In Home Assistant (HA), navigate to Settings > Add-ons and click on the SHOP ADD-ON button.
  2. Click on the three dots at the top right and choose Repositories.
  3. Paste the link— and click To add.
  4. Then click on the NVR Frigate in the add-ons section and click on Install.
  5. It can take some time. Once the installation is complete, open the File editor To add.
  6. Create a new file called frigate.yamlpaste the following code, then click to safeguard.
    mqtt: host: 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
  7. Go back to Add-ons and start Frigate. Make sure to activate Start at startup and Show in sidebar.
  8. Click on the OPEN WEB USER INTERFACE or Frigate in the sidebar to open and access the camera view.
  9. You can enable motion detection to record clips and snapshots when motion is detected.
  10. When there is movement or a person shows up, a video event is recorded and saved, which you can access at any time.

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

Step 3: Modify the motion mask

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

  1. Go to Frigate Web UI and click on the camera feed.
  2. Click on Debug then click Show options.
  3. Click on Mask and Area Creator.
  4. Create a mask by moving the black dots on the screen. Then copy the Motion masks values.
  5. Open the File editor and enter the copied mask values ​​in frigate.yaml case.
  6. Click on to safeguard and restart the Frigate add-on for the changes to take effect.

Do not hesitate to remove the movement part of the frigate.yaml file if you want to enable continuous recording.

If you are using a Raspberry Pi for Home Assistant, you may run out of storage space after a while as events are logged. You can increase storage and performance of Raspberry Pi by installing Home Assistant and booting Raspberry Pi via SSD instead of 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 CCTV camera and secure your home or office with automatic event-based recording. You can also enable continuous recording for 24×7 footage.

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

Comments are closed.