How to add a Unifi Protect Camera into Home Assistant


As part of our home automation setup video cameras provide eyes on the ground on what is actually happening in your home.

I particularly love using Ubiquities line of IP cameras called Unifi as they provide local stored content without paying for any ongoing fee or subscription. The also have a competitive price, the model I used for this post is the Unifi UVC Flex check current prices from Amazon US or UK

 

What you will need to do this project

In order to accomplish this project you will need a Unifi protect installation I have a cloud key gen 2, get one on Amazon US or UK.

I recently migrated from a Unifi Video setup installed on an Ubuntu server on a docker to a new cloud key generation 2 with Unifi Protect and have been using this for a month and find no issues at all with the setup. Unifi Protect is the future direction that Ubiquiti are investing and Unifi video is going to be phased out.

You will also need an installation of Home Assistant.

I’d recommend having your IP cameras setup with a static IP address so that you don’t need to change the home assistant configuration every couple of days when the DNS lease expires.

 

  • Go to your Unifi Protect UI and get the IP address and take note of it.
  • Within your Unifi Protect UI get the IP address of the camera and take note of it, you will need it in the next step

Configuration into Home Assistant

Go to your configuration.yaml and add the following code:

camera: 
 - platform: generic
   name: UVC FLEX
   still_image_url: http://192.168.1.49/snap.jpeg
   stream_source: rtsp://192.168.1.3:7447/Cn4RE45aBiJcArEn
   verify_ssl: false

Replace the still image url with the url of your IP Camera 

For the stream source instead get the IP address from your stream source.

No instead of the “Cn4RE45aBiJcArEn” you will need to generate your own code.

You can do this by going to the Unifi Protect interface and select the camera that you want to integrate into Home Assistant, then toggle the RTSP with the highest possible resolution you can. Now copy and paste that URL into configuration.yaml. If you need visual support feel free to watch my youtube video!

 

Adding to Dashboard

  1. Add a new card into the dashboard
  2. Pick the picture entity card
  3. Find the entity ID and add it into the Entity and Camera Entity (you need both)
  4. Toggle Camera view to live

 

That is it! You should be able to have a visual live stream of your Unifi camera in home assistant.

 

As always, keep it digital!

 

giordano

Gio

Gio loves rabbits, smart home tech, WWII, travelling to Thailand & my favourite pizza is margherita with parma ham!

Recent Posts