Unifi Protect Integration

It’s still on my back burner of ideas, the trickiest part is trying to figure out how to scrape what cameras are in protect like the NVR component does. The rest of the component works in the same fashion.

For now I have it setup as a generic camera that works in the same manor as before, just have to manually configure them. I went this route especially because of new stream component.

The one thing I haven’t sorted, and didn’t spend much time on, is passing camera user and pass credentials so I just enabled anonymous snapshots for now. Log into each camera and enable that function and it works.

Enable RTSP under the protect interface and use that URL for the stream source if you want streaming, if not remove that section.

  - platform: generic
    name: Camera
    still_image_url: https://CAMERA_IP/snap.jpeg
    stream_source: rtsp://PROTECT_IP/RTSPURL
    verify_ssl: false
1 Like

Is there anything else you had to do to get the generic camera platform working? I have my flex working as an ffmpeg camera but when I try to configure as generic the stream won’t load in the front end and interestingly it also breaks my Ring and Nest cameras…

Same here, @geekoftheweek I have RSTP set up in protect and I have my camera set up like above but I am not getting any streaming. What am I missing? The “snap.jpeg” is solid but not the same quality…

It does break Ring, I noticed that as well. I haven’t had much time this weekend to look into it, but it seems to break something with FFMPEG. I haven’t found a fix just yet.

you might want to check my comment on the previous thread about the javascript autodetect, add ?latest to the end of your URL and test it:

1 Like

Make sure you enable anon snapshots as well, to make it load in the UI, you have to log into each camera to do so. I haven’t spent much time trying to figure out how to pass the auth creds back to it. No API on protect so it works different than how the NVR component is setup. The NVR component pulls the same exact snap.jpeg file so that works exactly the same once you get it to load.

You are also able to to configure the password in the GUI using this Guide

  1. Access the UniFi Cloud Key Gen2 Plus (UCK-G2-PLUS) via SSH. The SSH credentials will be the same as those used to access the Cloud Key’s management portal. By default, these credentials will be ubnt/ubnt.

  2. Once credentials have been accepted, update the system packages and install Nano with the following command:

    `apt-get update && apt-get install nano -y`
  3. The following command will open the configuration file for UniFi Protect using Nano and allow editing:

    `nano /usr/etc/unifi-protect/config.json`
  4. You should see text like this:

    { "ssl": {
    "crt": "/etc/ssl/private/cloudkey.crt",
    "key": "/etc/ssl/private/cloudkey.key"
    "mbToKeepFree": 32768

    Modify the file, adding a line at the end for “enableSsh”, to look like this:

     { "ssl": {
     "crt": "/etc/ssl/private/cloudkey.crt",
     "key": "/etc/ssl/private/cloudkey.key"
     "mbToKeepFree": 32768,
     "enableSsh": true
  5. Use Ctrl+O, followed by Ctrl+X to save the config.json file and exit Nano.

  6. Restart UniFi-Protect with one of these commands:

    service unifi-protect restart


    systemctl restart unifi-protect
  7. Login to Unifi Protect, Click the image on the dashboard

  8. In General you will now have an option for Device Password which you can specify.

  1. Login to the camera https://192.168.x.x/camera/config with the user credentials

    Username: ubnt
    Password: *Device_Password from GUI*

I believe that option is now exposed by default and wasn’t needed for my newer installs.

That’s right–no SSH is required at this point.

Does anyone have a way of enabling and disabling motion detection from within SSH?

1 Like

Thanks to the info in this thread, I was able to get stills and streams working with a Cloud Key Gen 2 Plus.

Thanks @geekoftheweek and @noodlemctwoodle!

1 Like

I understand replying to an existing thread is not ideal. However, I have everything working except the live stream. For some reason,I am not able to view it through HA.

This is my configuration.yaml configuration section:

  - platform: generic
    name: Front Porch
    stream_source: rtsp://
    verify_ssl: false

And this is my ui-lovelace.yaml file section:

  - title: Cameras

      - type: picture-entity
        entity: camera.front_porch
        name: Camera1 Still

      - type: picture-entity
        entity: camera.front_porch
        name: Front Porch Live Stream
        camera_view: live

      - type: picture-glance
        entities: []
        camera_image: camera.front_porch
    icon: 'mdi:camera'
    panel: false
    path: cameras

The stills are visible, the stream is not.
Anything obvious I might be missing? TIA

Opening new thread for my question… My apologies, should have done that from the start.

@kymnyth Did you find a solution to viewing the live steam?

I’m using the custom camera module which shows the live view from the unifi G3.



  - platform: generic
    name: Back Garden
    stream_source: rtsp://
    verify_ssl: false

Lovelace config:

url: /local/custom_ui/camera-card.js
  - type: module

entity: camera.back_garden
type: 'custom:camera-card'

@noodlemctwoodle No I have verified everything a number of times with no luck. I have not tried making custom cards and I’m not sure how to go about what you suggest.

Is there any new progress with trying to get some sort of Unifi Protect support?

It seems like without an API like the previous Unifi NVR that this might not be possible? I found this active thread that would be worth upvoting: https://community.ui.com/questions/Unifi-Protect-API-or-Motion-alerts-hit-API/b5c6cf44-651c-4751-98a8-c55d7ce9bd5f

Since it works as a generic camera with the stream integration it’s kind of a moot point / dead at this time, didn’t really see the need to pursue it further since it works now. If an API is ever officially release could look into it again possibly.

It also actually worked with the previous Unifi NVR component but the auto discover piece needed some work, the generic camera with stream support is a much better integration.

Do you have a location for showing the support for the Unifi cameras with the generic camera /stream support?

I seem to be having issues getting snapshots and streams to work with Home Assistant despite enabling RTSP in Unifi Protect (on multiple resolutions) and anonymous snapshot directly on the Unifi Camera.

Exactly what I use here:

Make sure you also have stream enabled

Excellent! Thank you, I needed the


component in my configuration.yaml. I also needed the DIRECT ip to the camera for the still_image_url instead of the Unifi Protect instance the rtsp stream source points to.

Now they both work. (Still and stream)

Also – thank you for your contributions on github. I’ve referenced your repo numerous times – it’s great.