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

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

Hi Seaside.

I sometimes have the issue, that a person ringing the doorbell does not get detected. From looking at my logs the “IsRinging” Event does not fire, but the “LastRingTime” date changes to a newer value.

2021-12-07 15:20:46.552 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from OFF to ON
2021-12-07 15:20:48.423 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamRingThumbnail' changed from raw type (image/jpeg): 25074 bytes to raw type (image/jpeg): 23403 bytes
2021-12-07 15:20:53.932 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from ON to OFF
2021-12-07 15:21:24.060 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from OFF to ON
2021-12-07 15:21:26.155 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamRingThumbnail' changed from raw type (image/jpeg): 23403 bytes to raw type (image/jpeg): 25917 bytes
2021-12-07 15:21:28.925 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from ON to OFF
2021-12-07 15:21:32.690 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamLastRing' changed from 2021-12-07T12:33:18.397+0100 to 2021-12-07T15:21:23.439+0100
2021-12-07 16:37:15.418 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamRingThumbnail' changed from raw type (image/jpeg): 25917 bytes to raw type (image/jpeg): 22971 bytes
2021-12-07 16:37:15.419 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from OFF to ON
2021-12-07 16:37:18.730 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from ON to OFF
2021-12-07 16:37:39.920 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamLastRing' changed from 2021-12-07T15:21:23.439+0100 to 2021-12-07T16:37:13.188+0100
2021-12-07 17:28:36.797 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from OFF to ON
2021-12-07 17:28:38.791 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamRingThumbnail' changed from raw type (image/jpeg): 22971 bytes to raw type (image/jpeg): 10704 bytes
2021-12-07 17:28:41.817 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamIsRinging' changed from ON to OFF
2021-12-07 17:28:44.158 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamLastRing' changed from 2021-12-07T16:37:13.188+0100 to 2021-12-07T17:28:36.520+0100
2021-12-08 10:58:21.507 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FrontDoorCamLastRing' changed from 2021-12-07T17:28:36.520+0100 to 2021-12-08T10:58:18.681+0100

here the corresponding openhab.log entries

2021-12-08 10:58:16.301 [ERROR] [al.thing.UniFiProtectNvrThingHandler] - Failed to get event, ignoring: UniFiProtectAction [action=add, modelKey=event, id=61b081b800183403e700186b]
2021-12-08 10:58:16.760 [ERROR] [al.thing.UniFiProtectNvrThingHandler] - Failed to get event, ignoring: UniFiProtectAction [action=add, modelKey=event, id=61b081b802023403e700186c]
2021-12-08 10:58:18.948 [ERROR] [al.thing.UniFiProtectNvrThingHandler] - Failed to get event, ignoring: UniFiProtectAction [action=add, modelKey=event, id=61b081ba02ad3403e700186d]
2021-12-08 10:58:21.959 [WARN ] [otect.internal.model.UniFiProtectNvr] - Heatmap request resulted in a error size image
2021-12-08 10:58:21.989 [WARN ] [otect.internal.model.UniFiProtectNvr] - Heatmap request resulted in a error size image
2021-12-08 10:58:21.990 [ERROR] [l.thing.UniFiProtectBaseThingHandler] - Failed to set heatmap, event type not present: UniFiProtectEvent [type=motion, start=1638957492944, end=null, camera=6109692702802b03e70003ed, score=81, id=61b081b800183403e700186b, metadata=MetaData [objectType=null, objectCoords=null, objectConfidence=null], modelKey=event, partition=null, thumbnail=e-61b081b800183403e700186b, heatmap=e-61b081b800183403e700186b, smartDetectTypes=[], smartDetectEvents=[61b081b802023403e700186c]] or invalid heatmap: null

The last ring at 10:58:18 this morning just came through as a ItemStateChangedEvent for Last Ring. The IsRinging Change from OFF → ON and back is not there. It seems there were some events which could not get handled.

Any idea what that might be?

Thanks in advance,
Chris

The reason why lastRingTime is updated is basically because that info originates from the boostrap.json, which is pulled every minute. The doorbell notification originates from the websocket connection notification. My guess is that some notifications over the websocket is not working correctly for some reason.

I have noticed this myself with my G4 Doorbell. Have you tried the beta2 version?
I have not seen it since i switched and upgraded UniFi Protect to 1.20.0.
Let me know if it’s still an issue on 1.20.0 with the beta2 binding, meanwhile, I’ll also see if it’s an issue for me.

Regards, S

I was already on 1.20 when this happened, but I have upgraded to beta2 after that. I’ll report back.

After a very first check, beta2 seems to solve the issues! Cam’s channels are updated and NVR does not lose the connection after adding a cam / channel. I will setup all channels and all cams at the weekend and come back to you if any problem will occur.

Meanwhile thanks a lot @Seaside!

1 Like

I cannot install the binding anymore. I’m lost for clues. Can anyone point me to the logfiles that are used when installing stuff?

Hi! How are you installing it? Using the ui or manually placing the jar in the addons folder?

Using the UI. I get the following error:

Installation of add-on 107692 failed
runtimeInfo:
  version: 3.2.0
  buildString: "Build #2615"
locale: en-NL
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.13
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.52+13-CA
  osName: Linux
  osVersion: 5.10.63-v8+
  osArchitecture: aarch64
  availableProcessors: 4
  freeMemory: 53345296
  totalMemory: 201326592
bindings:
  - astro
  - bigassfan
  - chromecast
  - dsmr
  - harmonyhub
  - miele
  - network
  - nibeheatpump
  - smaenergymeter
  - sonos
  - unifi
  - zwave
timestamp: 2021-12-10T07:51:36.899Z

Placing the jar in the addons folder resolved the problem of the binding not being available.

However in the bindings marketplace I still see the following, is that correct?

I deleted the jar in /var/lib/openhab/marketplace/bundles/107692 and reinstalled the binding via ui, now it is working again

Currently i have a small problem. The bridge shows online and my G4 Doorbell as well, but i do not get any Data from the doorbell. All entries are NULL

Any ideas on that?

HW: Cloudkey gen2+, G4 Doorbell latest Firmware versions

Hi!

There has been several updates, I would suggest you delete all cameras and the nvr. Then readd them. If you use the same id on the NVR your items should not be affected. Also cameras should be discovered if you press scan, so should be fairly easy.
Let me know if you still have problems after readding them.

BR S

1 Like

readded the doorbell -now i get data.

thanks for the advice

1 Like

The update did the trick, all working again. Thanks @Seaside

1 Like

I tried to get some snapshots, but something ist not right with the path

2021-12-17 19:15:37.171 [ERROR] [ifiprotect.internal.UniFiProtectUtil] - Failed to write to file: /static/images/surveillance/6148af730153b903e7001839--snap.jpg , for camera id: 6148af730153b903e7001839 

Unfortunately is see no reason why the write should fail. Another question is: What is the difference between snapshot and anonymous snapshot

Answer to me: the path to store pictures should be fully qualified.

/etc/openhab/html/imgaes/surveillance/

ist working.

Still the quest snapshot (getting some now) vs. Anon snapshot (doesn’ t get one)

Have you set up anon snapshot according to instructions in the first message? You need to approve it per camera in the settings on the actual camera. Otherwise to you see any error messages? You could try and enable debug for the binding to see if you get some more information.

Best Regards, S

Even if i think that teading instructions is overrated :wink: sometime it works like a charm after doing so.

Thanks for the hint.

1 Like

Unfortunately the issue still exist. I get a lot of door bell rings that are not pushed through.

The error is

Failed to get event, ignoring: UniFiProtectAction [action=update, modelKey=event, id=XYXYXYXYXYXXY]