Ubiquiti UniFi Video and Protect NVR Integration

You sir, are awesome. Was hoping my UniFi cameras would eventually be integrated into ST, and you’ve just made it a reality. Especially useful considering Ubiquiti’s push notifications have seemingly never worked.

Thanks a bunch!

In my local sandbox I’m working on using the details page to show connection status. I don’t know if I can update the main tile dynamically.

Thanks!

@cvincent. Thanks again for this. The camera works well as a motion sensor as long as it is set to record. This gives me some incentive to purchase more external cameras. I can use the camera to turn on outdoor floods and more.

I posted a message to the UniFi video forum pointing here. If you are a forum user, you should go over and get credit for this great work.

This is something I have wanted ever since getting the Smartthings Hub. Looking at buying more UBNT cameras as I currently have 3 of them and love them. I have this App installed however I must be missing something as I don’t see any camera’s. Besides just using your code and making the App via smartthings IDE what else needs to be done for the camera’s to show up?

Ken~

  1. Create the app from the code in unifi-nvr-smartapp.groovy (sounds like you have this done)
  2. Create the device handler from code in unifi-nvr-devicehandler.groovy
  3. Make sure you publish both of them to yourself
  4. Verify that the NVR you are using has the API key enabled (instructions are on the github page)
  5. Verify that the NVR and the ST hub are on the same subnet and aren’t firewalled from eachother for any reason
  6. Using your SmartThings app on the phone, install the UniFi NVR app from “My Apps”.

If you did all these, I’ll need some logs from the IDE to see if there are any clues.

I never did step 2, but just did that. I have looked at the logs and can see it hitting the NVR with my correct API Key. I did however need to change my port on your App to use port 7443 (default for NVR) before it would show a connection via the logs.

From here where do I “see” the camera’s? I have looked under “Things” within smartthings app but none of the camera’s show up. I have installed many apps, but for some reason this one is kicking my butt :frowning:

Ken~

7443 is the default for the HTTPS endpoint, but you need to make sure it is using HTTP which is port 7080 by default. If the app can talk to the NVR correctly, it will create cameras for you in the “Things” list using the camera’s name and model.

Are you able to take logs from within the IDE? Clear out the app from the phone, open up the “Live Logging” window in the IDE then add the app on your phone again. It should print logs about communicating with the NVR.

I got it working now. Changed the port back to 7080 (http) and then looked again at the logs, and showed wrong API key. Looks like it was because I couldn’t tell the difference between a capitol I(eye) and lower case l(L). Once I made that change everything started connecting.

Thanks for the help and the awesome app :slight_smile:

Ken~

Awesome! Enjoy and thanks!

I just pushed support for image capture. Go to the device details screen and hit the take button to request an image. It pushes the data to S3 so you don’t have to be on the LAN for it to work. It is an image carousel so you can scroll through recent photos and tap on one to bring up more options that ST provides. I have no idea how to manage the images in S3 as the interface is not documented well (at all?) by ST.

Update for 1/15/17 includes a fix introduced yesterday and the ability to take a snapshot when motion is detected.

Image capture has been re-enabled with old announcement below

Announcement: Image capture disabled by ST

A few days ago, without notice, SmartThings pushed an update to their software that disables the methods to store images in S3. This means that there is currently no mechanism for device type handlers to utilize the ST platform for image capture and storage. I will have to disable the image capture capability and wait until they create an officially supported API for this. Sorry folks. I will also look into using a different hosting method because ST has a pretty large backlog of things and its unclear where this feature will fall in priority.

Update on 1/28 - Image capture is back

ST has released their new API for temporary image capture. Please update the device type from the code in GitHub and image capture will work again.

Excellent work @cvincent i recently switched from surveillance station with axis cameras to Unifi and this is exactly what i have been looking for. Thanks for the hard work.

You are very welcome!

Update on 2/4 - Fix for change in image storage API

SmartThings changed their API again for image capture, which required a small change in the device type handler to keep it working. The latest version keeps up with this change.

If somehow SmartThings implements a process in which they will announce these changes, it will prevent the integration from continuously breaking but for now it’s whack-a-mole. I don’t always discover these changes right away so please leave notes here or in a message to me if you find it breaks again.

First of all thank you for this. I’m new to st only had it a couple of days. I am using the NVR and going to try and get this up and running. Thanks for building this
Mike

This is pretty great. Easy to install and everything works so far. Is it possible to take a picture or record video based on smartthings triggers? For instance, Smart Home Monitor can use cameras to record video when security events are triggered. For instance, if a smoke detector goes off you could have it start recording on all cameras. But these aren’t showing up as “cameras”.

You are welcome. Let me know how the experience goes.

I’ll take a look. It exposes itself as image capture, but not as “Video Camera” or “Video Capture” so thats probably why it doesn’t appear in some smart apps. Unfortunately, SmartThings doesn’t officially support either one of the video capabilities in their documentation.

I set it up and no cameras populated. Do you need a specific NVR version?
I can’t upgrade to the newest because I have some older cameras.