Home » Blog » Boost your Security Camera Video in Home Assistant using WebRTC!

Boost your Security Camera Video in Home Assistant using WebRTC!

Hey! Do you use security cameras around your house and want to improve the video speed of your cameras? Then WebRTC is just the solution for you. I will show you how to set this up in minutes in this Home Assistant tutorial. Let’s do this!


⭐⭐⭐ NOTE: ⭐⭐⭐

This article accompanies a YouTube video. I wrote it for people who would rather read than watch a video. To keep doing this, I would like to ask you to also check out the video, leave a comment under the video, give the video a thumbs up, and subscribe to my YouTube channel. This means that the video is offered more often to new visitors so that they also stay informed of the latest Home Assistant tutorials.

Thank you for your support!

Ed

Click here to watch the video

If you own security cameras and monitor them using Home Assistant, you might notice that there can be some delays between the live stream of your camera and the actual events that take place. I can imagine that you want these delays to be as short as possible. Luckily this can be done by using WebRTC. WebRTC is an open-source project that enables real-time communication in web browsers and mobile applications. With WebRTC, you can create applications that allow for peer-to-peer audio and video communication. In Home Assistant, this can be useful for setting up a video doorbell, security cameras, or any other device that requires live video streaming.

Setting up a camera

Let’s start by setting up a camera. I will show how you can set up a generic camera so that it works for all types of cameras. Your camera needs to support RTSP to make this work. This will also work for cameras that you’ve already installed in your system. For instance, if you have the Reolink integration installed for your Reolink cameras, you do not need to install it again as a generic camera. But, in my experience, webRTC works best with the generic camera integration.

  • Go to Settings.
  • Go to Devices & Services.
  • Click Add Integration.
  • Search for Generic Camera.
  • Click Generic Camera.
  • Enter the URL for the still image. This URL can be found in the documentation of your camera.
  • Enter the URL for the stream source. This URL can also be found in the documentation of your camera.
  • I’ve added the URLs for the Reolink cameras in the description below, so you can just copy and paste those and replace the demo IP address and credentials with your own.
  • Enter the username and password of the camera.
  • And click SUBMIT.

If the URLs are correct, then Home Assistant will show a preview of your camera. Click “This image looks good”, and click SUBMIT. Click Finish.

Test the Security Camera Video

The camera is now installed in Home Assistant. Let’s see if it works!

First, I am going to rename the camera by clicking on the three dots on the camera card. Click Rename and enter a friendly name for the camera. Click OK.

Now click on the entity and click on the camera. The camera will show and you can set some of the options of this camera. Click on the cog wheel. You can toggle the Preload camera stream switch so that it shows faster. This might already be quick enough for you, but WebRTC is way faster as you will see in a minute. Let’s rename the entity id as well so that I can recognize the camera easier in my system.

Install WebRTC

The camera is now installed and configured, so we can start installing WebRTC now. First, we need to add a repository to the add-on store in Home Assistant.

  • For this, go to Settings > Add-Ons.
  • Click Add-On Store.
  • Click the three dots in the right upper corner.
  • Click repositories.
  • Enter the following repository URL: https://github.com/allenporter/stream-addons.
  • Click Add.
  • Click Close.
  • Refresh your browser.
  • Enter webRTC in the search field.
  • Click on the RTSPtoWeb – WebRTC card.
  • Click Install.
  • Toggle Watchdog and Auto update on if you like and click START.

Add WebRTC to Home Assistant

The Add-on is now installed. The next step is that we have to activate it in Home Assistant.

  • Click Settings.
  • Click Devices & Services.
  • If everything went well, you will see that RTSPtoWebRTC is discovered in Home Assistant. If you do not see this, then add the integration manually by clicking on Add Integration and searching for RTSPtoWebRTC.
  • Click Configure.
  • You shouldn’t be presented with an input field here, but if you do, then you can enter the WebRTC URL manually. That URL is http://homeassistant.local:8083/.
  • Click Submit.
  • Click Finish.

Configure WebRTC

WebRTC is now installed. Let’s configure it! To open webRTC, go to this URL: http://homeassistant.local:8083/. You can also go back to the WebRTXC add-on and click Open WebUI instead.

You will probably see no streams yet on the Dashboard and the streams list. The camera that you installed before should appear automatically after some time, but I am going to show how you can add it manually.

  • Go to Add Stream.
  • Enter a name for your stream.
  • And enter the same stream URL that you used for the camera that you added in Home Assistant.
  • Select Persistent Connection for the Stream Type.
  • Click Save Stream.
  • Click OK.
  • Click on the All link.
  • You will now see the camera 4 times for different protocols.
  • You will notice that the WebRTC stream is the fastest of all the streams.

Add the camera to your dashboard

Let’s add the camera to your dashboard now.

  • Open one of your dashboards.
  • Click on the three dots in the right upper corner.
  • Click Edit Dashboard.
  • Click Add Card.
  • Select the Picture entity Card.
  • Select the camera in the Entity. You can select any entity here.
  • You can enter an Image in the image path, but you do not really have to. I enter the snapshot URL that I used before when I added the camera to Home Assistant before.
  • Select the Home Assistant camera entity.
  • Check the live radio button.
  • Click SAVE.
  • Click DONE.

The live stream should now show very fast on your dashboard and should show live on the card without having to open it.

Congratulations, you have now successfully installed WebRTC in Home Assistant! If this tutorial saved you time, please consider sponsoring me just like these wonderful people do. This is the only way how I can keep creating these tutorials for you. The links to Patreon, Ko-Fi, and Joining my Channel are in the description below. Thanks for watching and don’t forget to give this video a thumbs up and subscribe to my channel so that it will be presented to more people on YouTube!

I’ll see you in one of my other videos!

Bye Bye!

homeassistant, camera,security camera, cctv, webrtc, surveillance, dashboard, security system, video doorbell, doorbell camera, the ring doorbell, smart home, tutorial


,

Back to all articles