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

Got it working again. I’ve removed all UniFi Protect Things (cameras and the bridge) and readded everything again.

For now, it’s working again.

Wasnt there an update for protect not so long ago?

Oh boy… This works only a couple of minutes. Then everything’s goes south…

No Update from the Controller anymore:

[INFO ] [ernal.event.UniFiProtectEventManager] - Socket failed, reinitializing!

And that’s it. This appears every minute or so in openHAB.log.

I will try to fetch some debug logs later…

I have Multifactor Authentication Enabled for my Unifi account. Perhaps this is what is blocking me as the binding is not sending the second factor (i.e. token) to the app when the bridge is trying to connect.

I can try to turn MFA off and see if this works :man_shrugging:

You don’t need to. You could add a local user account when login directly to your cloud key/dreammachine/NVR.

1 Like

Configuring a local account got it working!! :+1: :+1:

Really appreciate your help on this one. Reading the instructions for the binding I did not realize that the account needed to be local.

Manual Setup

Will suggest an update to highlight that this account should be local.

Thanks again!!!

1 Like

After removing and readding everything again, its working now.
I added the cameras via the “scan” option while adding a thing. I dont know if there was a problem before.
There must be a typo on my end somewhere i guess :slight_smile:

UPDATE:

Maybe not? I got the same symtoms this issue here:Connection lost after 20min. with latest UDM PRO Protect version 2.10.11 #19

Sorry for being absent. Had a lot lately and on top of that my ckg2+ broke down completely. However i have now gotten a new one. Will try to look into these issues.

Br s

1 Like

Quick question. I’m getting frequent communication timeouts to my UDM. I did catch this once with TRACE level logging and didn’t see any communication retry attempts before it takes the thing offline. Is there any chance you would consider adding some retries? Thank you for all of your efforts with this binding. It’s appreciated.

2024-01-23 02:55:06.174 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-23 12:55:06.709 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-23 22:55:04.797 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-24 06:48:46.263 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Execution fault when sending request to UniFi Protect
2024-01-24 11:50:48.495 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-24 12:50:58.430 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-24 21:50:49.891 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-25 07:50:49.903 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-25 18:50:51.612 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-26 04:50:51.305 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-26 14:50:49.462 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-27 00:50:50.709 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-27 10:50:50.811 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-27 20:50:49.900 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-28 06:50:49.329 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-28 16:50:52.925 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-29 02:50:50.131 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-29 12:50:51.089 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-29 22:50:50.701 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-30 03:11:19.103 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-30 07:50:50.848 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-30 17:50:51.084 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-31 03:50:52.417 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-31 10:50:57.538 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-31 15:50:56.128 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-01-31 20:50:55.720 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-01 01:50:55.395 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-01 06:50:54.313 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-01 11:50:54.438 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-01 13:27:10.184 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Execution fault when sending request to UniFi Protect
2024-02-01 16:50:53.064 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-02 01:50:50.660 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-02 07:50:58.896 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-02 17:50:53.365 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-03 02:50:50.788 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-03 11:50:49.786 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-03 20:50:49.035 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-03 21:50:59.371 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-04 06:50:49.932 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-04 15:50:49.739 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-04 16:50:59.326 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-05 01:50:54.435 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-05 10:50:51.372 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-05 20:50:52.980 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-06 06:50:53.379 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-06 16:50:52.437 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect
2024-02-07 02:50:51.976 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Timeout while sending request to UniFi Protect

Yes could consider retries. However chasing the websocket closed bug now, please register an issue on github and I will take a look.

Hi Seaside,

Unifi OS 3.2.9 on UDM Pro
Protect 2.11.21
OpenHab 4.1.0

Having some issues with the binding stopping working after a couple of hours (i.e. detection, doorbell events no longer reported). The catalyst seems to have been an update to the UDM Pro firmware (it came from quite an old one, 1.x.x due to resolving a long standing issue of failing to update). The binding seemed to work fine prior to the firmware update.

Now, when I (re)start the OpenHab container, it works perfectly for around 2 hours, then just silently stops sending events (although the binding and cameras still have the ‘Online’ badge).

It fills the OH log up with:

2024-02-09 15:27:26.931 [ERROR] [otect.internal.model.UniFiProtectNvr] - Failed to updated Cameras since we can't seem to login status: TOKEN_MISSING
2024-02-09 15:35:02.331 [INFO ] [ernal.event.UniFiProtectEventManager] - Watch dog Detected no events recieved, reinitializing!
2024-02-09 15:35:12.332 [INFO ] [ernal.event.UniFiProtectEventManager] - Socket failed, reinitializing!

The Unifi console also logs regular ‘xxxxxuser accessed UniFi Protect using the web.’, which I’d assume is the watchdog.

After reading around without finding much in the way of answers, I’ve tried setting a longer password, and switching on / off the watchdog, with no improvement unfortunately.

Any clues you might have on this much appreciated.

Sounds very much like the issue both me and others are experiencing with the new firmware.
I have a prebuild available here: Release unifiprotect-4.0.0-v1.3-1 · seaside1/unifiprotect · GitHub

You can test it and see if it solves your problem.

BR S

12 hours later and still going strong, so tentatively calling it a fix! Thanks Seaside, appreciate your work.

1 Like

Thanks for testing out. I have released a stable version now that should be available on the openHAB market as well.

@Seaside any plans for supporting the unifi viewport? I would like to change the view from 4 cams to only the doorbell when someone rings the bell.

I have not explored the viewport myself. Is it possible to change the view using the Protect UI?
Is the view port listed as a device in protect?

Yes, the vewport is listed in the protect ui, and has a property to change the view.
image

Total newbie… just installed the binding and have Unifi NVR, the G4 Doorbell and a G5 Camera Things all added and showing as online…

I have added the items which load with no errors…

I simply want a couple of basic rules next to trigger announcements via Alexa, but totally failing to get any events to trigger things… Looking at G4DBIsRinging for the doorbell button pushed and G4DBSmartDetectMotion for when people or vehicles are detected…

Any pointers to a simple rule or some sample rules online somewhere… Sorry if I’m being dim and missing something obvious… (I’m still manually writing .rule files BTW).

Hi,

i am new to unifi protect and this binding and have the following question:
Is it possible to switch “when to record” and “record AI Events” with this binding?
Did not find the channels in the examples / docs.

Thanks in advance,
Alex

Edit:
I finally found the right channel at the docs (recording_mode), but just for each cam. Is it possible to set the global value, also?

Thank you!

Is this new version really on the market place?

It says there:

Hi!

I have a new AI Pro camera but the binding is recognized it as a G3 Camera. Is it possible to create a new type of cam? Or can I manually add this cam as a G4/G5 one? Which one to choose to get all channels (no smart channels on G3).

Thank you.