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

It is working for me. Let me do some testing and come back. Are you sure you don’t have any expire or similar?
Also if you are not persisting the state of the switch it might turn off if you restart openhab.

BR S

Well, you are correct, I did have expires on my channel on the item. I didn’t even notice it. I took your examples straight from this page and edited the names. I didn’t even notice they were there/ thought they were needed. Whoops. Don’t know if you want to edit that incase someone else does a stupid mistake like this :sweat_smile:


Switch  G4DBLcdLeavePackage  "G4DB LCD Leave Package At Door" (G4DB) { channel="unifiprotect:g4doorbell:NVRID:MACADDRESS:lcd-leave-package"**,expire="5s,command=OFF**" } 
Switch  G4DBLcdDoNotDisturb  "G4DB LCD Do not disturb" (G4DB) { channel="unifiprotect:g4doorbell:NVRID:MACADDRESS:lcd-do-not-disturb",expire="5s,command=OFF" } 
Switch  G4DBCustomMessage  "G4DB LCD Custom Message" (G4DB) { channel="unifiprotect:g4doorbell:NVRID:MACADDRESS:lcd-custom",expire="5s,command=OFF" } 
String  G4DBCustomMessageText  "G4DB LCD Custom Message Text" (G4DB) { channel="unifiprotect:g4doorbell:NVRID:MACADDRESS:lcd-custom-text" }

Thanks!

1 Like

Hi @Seaside

installed the binding yesterday and there’s an old issue back in town :smiley:

Could not find any valid user. Looking for: OpenHab

Unifi OS Version (CK Gen2): 2.2.12
Unifi Protect Version: 1.19.2
OpenHab: 3.1.0
Binding: org.openhab.binding.unifiprotect-3.x.x-ALPHA17
User: UserName and FirstName are the same

I deleted and added the bridge/cams and restarted OpenHab several times. It’s not working.
Hope there’s a way to fix this? :smiley:
Thx

I’m getting the following error approximately every 25 minutes. Can anyone shed any light on this? Thanks!

2021-11-12 12:06:12.929 [ERROR] [al.thing.UniFiProtectNvrThingHandler] - Failed to get event, ignoring: UniFiProtectAction [action=add, modelKey=event, id=xxxxxxxxxxxxxxxxxxxx]

The handler is notified that there is a websocket event happening, these are processed and put into hashmaps, when the code asks for info about the event, we cannot find it in our cache.
I’m not sure this is a bug or not, it could be safe to ignore or could actually be something. I have them as well in my logs, I will see if I can handle this better, if it’s not important I will change logging to debug so it’s not displayed at least.

BR S

Hi guys,
yesterday I updated Unifi OS (v2.2.12), Network (v6.5.53) and Protect (v1.20.0) on my UCKP. Since auto-updates are disabled within Unifi OS I am pretty sure that there were some former updates not installed - just as information.

Since those updates OH3.1.0 is running into OOM issues all the time. Several restarts of OH and Windows lead to a proper running OH for some minutes until RAM gets highloaded and any click on the PC and / or OH Main UI takes several minutes.

Since the updates on my UCKP were the only thing changed, my first assumption was that Unifi binding were causing the issue since Controller thing was offline and showed an error. After a short discussion in Unifi Binding Thread, I could figure out that actually Protect binding (ALPHA17) is causing the OOM issue. After disabling Protect NVR thing as well as all the cams, OH is working fine again.

Is there anybody running with above mentioned versions? Any issue with OH OOM? Or any idea at all?
If you need any information from the logs (e.g.) please let me know. Thanks!

Hi!
I also have a UCKP i’m running fw 2.2.5 and protect 1.19 under openhab 3.2. I have no memory issues. I’ll try to upgrade my UKCP and see if I run into the same problem.

BR S

I have updated to 2.2.12 and 1.20.0 now. No issues so far.
How long does it take before you get oom? Do you mind sharing your rules?
You can also enable debug for the binding, it will produce a lot of logs, but might give a clue as to what is going on.

Br S

FYI: Updated to Unifi Protect 1.20 … no problem anymore

Based on the discussion with pacive it’s an issue of the login procedure. We could find this out for the Unifi binding since it’s not working but at least not crashing whole OH. He mentioned that Unifi binding version for OH 3.2.0.M4 includes a few bug fixes which may resolve the issue. If it’s interesting for you, you can find it here. Since you are also running OH3.2 I guess I will try the OH update to Milestone first.

Regarding your questions:

  • The OOM comes up after a few minutes after (re-) starting OH. I assume that at this time the login happens.
  • I will reactivate protect and set log level to debug.
  • I do not use any rule für UVC, just a few things in a sitemap and habpanel to set some things manually.

Keep you informed!

Edit: I am wondering about the Two-Factor-Authentification - I was pretty sure that enabling this is mandatory since a few month, but I saw that this is disabled in my Unifi account. Might this be sonmehow related to my issue? Did you enable 2FA?

Edit2: after update to OH3.2 everything is working fine again! Thanks for your support! :slight_smile:

Like I said in the UniFi thread, might still be an issue to fix the login, it should probably back off and not be that aggressive.

I agree, even there is any issue, it would be great if OOM could be prevent.

Another thing: I fear I was too quick with my response that everything works fine after updating to OH3.2 :frowning:
Actually all things were online but the cam channels were not working. I did not recognize right away, sorry. I tried to delete / readd cam Things and found followings:

  1. NVR is online and working as long as no cams are added (Last Seen is updated every minute)
  2. NVR is online but not working when a camera is added (Last Seen not updated anymore at the moment when a camera is added)
  3. Channels of cam get not updated and stay NULL (==> 2.)
  4. Channels of cam get updated after restarting OH (most likely once at startup)
  5. NVR is online but Last Seen will be not updated anymore (==> 4.)

I set log level to DEBUG after restarting OH (one camera was added before stoping OH). May I send you the log file @Seaside? All entries not related to Protect binding were deleted, but the log file is still quite heavy, though. And to be honest I am not sure if there are any sensitive data inside, that’s why I prefer a PM instead of posting here.

Regards,
Sascha

Sure you can pm me the logs. Feels like there is some issue with the login. You should look at the bootstrap json.

Best regards s

Send you a PM. Thanks in advance!

Mine was working fine until I updated to Unifi Protect 1.2.0. I also started running into the OOM issues. I’ve disabled the binding for the time being to restore my OH function. I am running 3.2.0.M4,

I was running 3.1.0 when I had the OOM issues which do not occur anymore with 3.2.0. After a restart of OH, how long will it take until you get OOM? If it occur only a few minutes after restart, I guess it is also an issue of login procedure.

I’ll look into it, from your log I can see some things, the login procedure needs to be refactored to be more robust.

I have not seen this issue myself.

Best regards s

The NVR thing is working fine when there is no cam added. When I add a camera as thing the connection of NVR gets lost. Ist there a difference in login when a camera is added or not?

On 3.2.0.M5 with Protect 1.2 get “Socket failed, reinitializing!” error and after 8-20 hr OOM. Had to disabled the binding as it brings down OpenHAB.

All things show online however, when taking a snapshot see this error but the snapshot works:

2021-12-07 10:10:42.351 [INFO ] [l.thing.UniFiProtectBaseThingHandler] - Getting snapshot for camera: Garage walkway, ip: 192.168.xx.xx
2021-12-07 10:10:43.340 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG3CameraThingHandler@2582f003': No enum constant org.openhab.binding.unifiprotect.internal.UniFiProtectRecordingMode.DETECTIONS
java.lang.IllegalArgumentException: No enum constant org.openhab.binding.unifiprotect.internal.UniFiProtectRecordingMode.DETECTIONS

Let me know if I can help.

I have done a fix for OpenHab 3.x support and fixed the renamed recording value.
Let me know if this works.
You might have to remove old cameras and nvrs and readd them. Make sure to use the same id for the nvr, and then you should be able to keep your old items.

Regards, S