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

You can’t. It’s hard coded for G3, G4 and G5
G3 1920x1080
G4 3840x2160
G5 3840x2160

This is populated in a config file, so I could expose that config with a minor update, but then the question is what size would you like and what camera are you using?
Does the snapshots you get from the UniFi Protect GUI look better?

Regards, S

Thank you for the answer. The quality is perfect when I do a snapshot in the Unifi Protect UI. I am using G3 Instant and G4 Instant cameras. The problem is not the size, it is just the quality. And what I can see as well is, the snapshot size from the UI is about 5MB, the binding snapshot size is about 300KB.

From what I can see my snapshots are not 5MBs from the UP-ui
G3 Pro gives around: 700 - 900 K
G4 around 1MB

Using snapshot from openHAB results in about 10 times less data. So yeah there is definitely a difference in quality since resolution is the same. I could not see any specific parameters being used from UI, the API used is reversed engineered, so I will have to try and see if I can find that hidden param that is probably passed to the API for higher quality.

/S

Hello
Many thanks for the binding. I have the following Question:

The “RecordingMode” read/write switch. I wanted the ability to change the recording mode, so as a test, I have my cameras set to always (1) record, though through changing it via the sitemap with the 0=Never, 1=Always, 2=Motion, I tried toggling to 0/Never, and the sitemap will update to Never, but if I have UniFi protect open and have the camera up, it never changes from Always to Never, and after about a minute in the OpenHAB Sitemap, it goes back to Always.

have admin rights in the openhab nvr. Where can i customize that. thanks for your contributions.
Greetings Ramon

Just wanted to share this error I’m getting on bootup. OH4.0.0.M4

2023-07-03 12:09:19.674 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:xxx' changed from INITIALIZING to ONLINE
2023-07-03 12:09:19.790 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:g3camera:xxx' changed from UNINITIALIZED (NOT_YET_READY) to INITIALIZING
2023-07-03 12:09:19.792 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:g3camera:xxx' changed from INITIALIZING to ONLINE
2023-07-03 12:10:19.763 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NoSuchMethodError: 'void org.openhab.core.library.types.DecimalType.<init>(long)'
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectBaseThingHandler.refreshChannel(UniFiProtectBaseThingHandler.java:141) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG3CameraThingHandler.refreshChannel(UniFiProtectG3CameraThingHandler.java:58) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectBaseThingHandler.refresh(UniFiProtectBaseThingHandler.java:103) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG3CameraThingHandler.refresh(UniFiProtectG3CameraThingHandler.java:48) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.lambda$1(UniFiProtectNvrThingHandler.java:220) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refreshCameras(UniFiProtectNvrThingHandler.java:218) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.refresh(UniFiProtectNvrThingHandler.java:211) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectNvrThingHandler.run(UniFiProtectNvrThingHandler.java:172) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

Hi!

Thank you. I’ll look into it, to see if I can fix it.

BR S

Please try this pre-release and report back.
Have not had time to test m4 myself yet.

BR S

So far so good. One reboot with no error. Thanks!

1 Like

4.0.0-BETA10
Still getting lots of these errors in the log…

2023-07-11 06:33:23.496 [WARN ] [l.thing.UniFiProtectBaseThingHandler] - Failed to find event fo eventId: 64ad2fde00efc103e400fef6 cacheSize: 2

So, I just replaced my G4 Doorbell with the new G4 Doorbell Pro PoE. Technically it should be the same as the G4 Doorbell Pro, just with an ethernet interface instead of wifi or that usb ethernet adapter. I cannot seem to get the binding to talk to it. I am running the BETA10 version. Any thoughts on how to get it working? I am seeing this message every so often, I don’t remember seeing it before I upgraded.

01:19:52.017 [INFO ] [ternal.event.UniFiProtectEventManager] - Socket failed, reinitializing!

Thanks for the binding, it has been great so far!

Enable debug logging and pm the bootstrap json and I’ll have a look

Is there a log filter you would like me to apply? Debug logging is super chatty.

The bootstrap.json will be stored in /tmp or similar, it is quite big. Search for bootstrap.json in your openhab log when debug is on. It will print out where it is stored.

Well, there is no bootstrap.json being stored anywhere on my openhab machine, regardless of the log level. However I did see an API call to the Cloud Key called “/proxy/protect/api/bootstrap” and it is indeed in JSON format with all the details of my Unifi cameras. Is that what you are looking for?

I have parsed your bootrap and that seems to be fine. I can’t see any reasons why the camera should not work. The camera is recognized and should work as a regular G4 Doorbell. Are you sure you have the same network setup? Is it on the same network as openHAB or on a another vlan?

In any case I can’t do much now the next step is to send me logs for some time before the “Socket failed” message and some time after the message (having debug log enabled).
Does it work for the other cameras in your system?

BR S

Well, I figured it out. When I defined the thing I put colons in the MAC address… Some words were said that I’m not proud of.

The doorbell does indeed work as expected. Thank you for taking the time to look through this.

No worries glad you got it working.

BR S

is this binding under development no alternative for openhab 4 ?

Yes it is working for openhab 4. Still under development.

Best regards s

1 Like

Can I also point something. I am also using the type of detection channel that normally should change from vehicle to person but putting a car info front doesn’t change. Any ideea why ?
Also after a day the motion detected channel stops sending updates and a restart of the binding solves the problem.
If i can help by debugging let me know.