UniFi Protect Binding (Cloudkey gen2+, Dream Machine Pro, NVR)

Try downloading it again.
I used the download button on github on my laptop (64 bit linux) and got:

josha@xcom:~/Downloads> ls -lt org.openhab.binding.unifiprotect-2.5.x-ALPHA6.jar
-rw-r–r-- 1 josha users 124675 Dec 3 22:06 org.openhab.binding.unifiprotect-2.5.x-ALPHA6.jar

If it helps, clicking the Download button on the link in your post gives me a 125kb file:

If I download the file (windows-client) - I’ll get a 95.174 byte-file

this is my result:
-rwxrwxr-x 1 openhabian openhab 95181 Dec 3 22:17 org.openhab.binding.unifiprotect-2.5.x-ALPHA6.jar

That’s strange - why is the size always different?

windows 10

image

I’ll try zipping it and upload it to gdrive then :slight_smile:

finally I got it!

Anyway - strange, that I got different sizes and it didn’t worked from linux directly. But now I see the binding in the console…

THX!

1 Like

I started from scratch with paperui items and rule creation using the loginfo action you recommended for testing. Think there may have been some issue from my end that I missed because everything is now working.
2020-12-03 22:01:59.693 [INFO ] [.smarthome.model.script.UniFiProtect] - Motion detected ON by UniFiProtect Hello World!

I can officially confirm that this setup is working with the Unifi G4 Doorbell for all motion related events. Binding would only need to add channels for the additional doorbell features such as ring event and control over message text if you ever decided to continue expanding on this.

Thanks again for the hard work - this is great!


1 Like

I’ve update to ALPHA8 for OpenHAB 3.0.0.

Happy New Year.

Thank you for this plugin. I am still on OH 2.5 so tried the version 2 however I did find the controller stopped responding after a short time. Rebooting the Gen 2 Plus got everything working again. But then it stopped.

The only command I was really after was changing the camera state from never = 0 to motion = 2

I dont know if the version I am using is to blame as I can see your no longer developing this.

Just wondered if this is resolved in 3.0 Alpha8 or this is another issue…

Thank you

Hi! Thank you for testing the binding. I have fixed reconnection with the controller, it might be the same issue you are experiencing. Are you planning on moving to openhab3? Otherwise I might be able to backport the fix, but it will take some time to do that.

Regards s

Thank you for replying… Was not expecting that :slight_smile:

I need to take a deep breath and look at upgrading at some point… After I ran into issues I was hoping to port your code to NodeRed which is where I do all my rules for OpenHab. But I was struggling with the API auth…

I am sure there are not enough people left on 2.5 with Unifi Protect to make it worth your while trying to maintain two sets of code. If you have any pointers with Postman for the API (or curl) I am happy to try and get it working in nodered. I can see the bootstrap output but failed to auth outside the browser :frowning:

I did look at the other codes repos you link to on your github and the one in Homekit seemed to report well but was missing the one part of disabling and enabling the cameras.

This looks great! I will try it out as soon as possible. Hope it gets included in the repository for OH3 soon!

Thank you so much for creating this binding @Seaside, I was able to set it up on my system (OH 3.0.0 on Raspberry Pi 4, Cloud Key Gen 2+ 2.0.24, ALPHA 8).

I ran into a couple issues during the initial test:

  1. The default item type for “Snapshot Image” seems to be set to String. I was able to get the image once I change the item type to Image. I noticed that image folder updates almost instantly but the Snapshot Image Item took a while (~10secs) to refresh.
  2. The anonymous snapshot doesn’t seem to work on my system. Is there something I need to enable? I tried this on G3 bullet and G4 doorbell and neither responded.
  3. I was testing on my G3 bullet when I think I clicked on the high FPS mode or one of the unsupported functions, and it may have caused the camera to be disconnected from the controller. I had to unmanage the camera and add it back to resolve that issue.

Note that after updating my Cloud Key to 2.0.24 the regular Unifi binding stopped working. I think it is related to this issue. I’m still transitioning to OH3 so the Unifi binding isn’t too critical but perhaps others may be interested to know beforehand.

Thank you again for this binding, it is really nice and solves my longstanding problem of OH not communicating with Unifi cameras. My G4 doorbell also works the same as other cameras which is majority of my needs.

Hi!

Nice to hear that even more people successfully can use this binding.

This could be a bug for OH3, I’ll investigate, but the type in thing-types.xml is specified to “image”.

I’ll investigate that, it could be a delay that’s in place for the motion events to make sure they are recorded in the nvr before requesting them, for snapshots the should be available more or less straight away,

You need to enable anonymous snapshot manually for each camera.
So login on each camera using it’s IP and enable anonymous screenshot.

I’ve also done that, but in my case it was enough to just disable it, to get it working again.
I think it’s a good idea to disable this feature in the binding for g3 cameras (I’ll do that in the next release).

Great I’ll add something about that in the text. I do think there is a developer version somewhere of the binding that works, but can’t seem to find the link now.

I’m planning to add more feature for g4 Doorbell once I’ve bought one myself, I’m just waiting for them to be available in the European ubiquiti store.

Thanks for testing the binding out, and providing feedback!

Regards S

I have added a ALPHA8 build for 2.5.x now as well. Hopefully it works better than the previous one (ALPHA6)

Regards, S

Thank you very much

1 Like

Thank you for the quick reply. I’ll search for the Unifi binding dev version and try to fix it :slight_smile:

I just checked the thing-types.xml on GitHub and looks like the item-type is set to String incorrectly (line 313).

I was able to get the anonymous snapshot once it is enabled in the camera. I missed the section in the Home Assistant link for the instruction to enable it, so in case someone else needs it:

To use the Anonymous Snapshot, you must ensure that each Camera is configured to allow this. This cannot be done in Unifi Protect, but has to be done on each individual Camera.

  1. Login to each of your Cameras by going to http://CAMERA_IP. The Username is ubnt and the Camera Password can be found in Unifi Protect under Settings.
  2. If you have never logged in to the Camera before, it might take you through a Setup procedure - just make sure to keep it in Unifi Video mode, so that it is managed by Unifi Protect.
  3. Once you are logged in, you will see an option on the Front page for enabling Anonymous Snapshots. Make sure this is checked, and then press the Save Changes button.
  4. Repeat step 3 for each of your Cameras.

Thank you for that. I’ve corrected it to be Image and added your documentation to the first post.

Regards, S

Added ALPHA9 version with the correction for the Image type for the snapshot.

Regards, S