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

Uinstall the binding first. Make sure it is properly uninstalled, then install the new one.

If you run bundle:list in the karaf console you can see which addons you have, if you have multiple it is important to uninstall all of them.

openhab> bundle:list |grep UniFi                                                                                                    
235 │ Active │  80 │ 3.4.0.202208231959     │ openHAB Add-ons :: Bundles :: UniFi Protect Binding
openhab> 

In this case above it would be:

bundle:uninstall 235

Also make sure that you can actually login in to protect with the user and password you have configured (try it in the browser).

BR S

1 Like

Well Slap my A** and call me Judhi… I was 100% sure that I did that… But it was exactly that.

Big thanks and should out @Seaside for helping and making it possible in the first place :slight_smile:

1 Like

Protect Ver.: 2.2.2
UnfiOS: 1.11.4
Binding: Beta8
OH: 3.3.0

After a restart of OH (because of other reason), the binding complained every now and then:

2022-10-15 16:26:33.808 [ERROR] [websocket.UniFiProtectEventWebSocket] - Failed to parse json

But the things were online.
After another restart of OH, the problem is gone.

@Seaside Lately the binding seems to be randomly soft disconnecting or something, you know, doorbell rings, openhab doen’t know anything about it, and the way to get it back is to uninstall and reinstall the binding (just restarting doesn’t work). Sometimes the binding throws an error about a missing token, others the binding thinks it’s connected. It seems to happen whenever either openhab is updated / restarted or the Unifi Protect application is updated / restarted (it got updated last night to 2.2.6). I’ve resorted to a cron job that uninstalls and reinstalls the binding at midnight. What can I provide to you to help troubleshoot this strange behavior? It clearly seems that this is not the case for most users.

I have some code for the Doorbell pro, after that I’ll take a look again.
For me I’ve never seen this. I have occasionally gotten the event API to be down, but that has been fixed with a restart of the binding.

In the Protect ap does it display any error, offline or similar?

/S

Sorry for the late reply, no errors in Unifi itself. All I have to do is something like restart openhab and it goes offline until my script fires, sees that it is offline, and reinstalls the binding. There’s nothing that I can see where Unifi itself is causing this. I can reproduce this at will so if you want me to do anything to get you data I can.

I think I know the cause. Again the case of 2 versions of the binding installed.
I was doing this:

  • install binding from Marketplace
  • uninstall that binding via CLI
  • install binding from GitHub via CLI

This should result in ONE binding installed. But then I saw in the log when openHAB started, that it AUTOMATICALLY installed a “missing binding”.
And then the version of the Marketplace was installed again.
I now uninstalled that one via the UI and it looks like this is settled now.

But this should not be different from uninstalling via the CLI IMHO.

@Seaside

Love the binding, works pretty well except for the “invalid heatmap: null” errors, even with the heatmap items and img items commented out (I have no need/use for them)

But I just noticed another oddity that I was hoping you could look into.

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.

Then I remembered my OpenHAB user may have only had read-only permissions, so I went into UniFi and granted it full management of the UniFi Protect app,

Tried it once and it successfully switched from Always to Never and updated in UniFi too, but after that it won’t change anymore. I’ve set it to Always in UniFi, and tried changing it back to Never via OpenHAB but nothing happens.

Is there something I’m missing, or anything else I can check? It worked once so I know it’s set up properly, but something seems to have gotten hung up.

I’m glad you find the binding useful!
I’m going to put some work on this binding, and I’ll add options to not use heatmaps.
Regarding recording mode, I have not tested in a while, I’ll test it.
It could be that the naming in the UniFi api has change or something else, I’ll try to have a look at it.

BR S

First of all … @Seaside thanks for creating this binding!
I would love to integrate my G4 doorbell, but I am not managing to do so.

My NVR connection works and it also detects all my devices - 3 cameras - but once I create the things from the scanned list, I only get null values. Even for the camera names, which were listed in the scan process.

Unifi Protect Version 2.2.6
OH version 3.1.1

Any ideas what the issue might be? I have enabled the debug logging, but I am not too sure what to look out for in the payload to see if things work.

Thanks!

Is it the G4 Doorbell Pro? I have added support for Pro, but I have not built a official version for it yet.

Using OH 3.3, Protect binding beta 8, G4 Doorbell.

I know, there is a known issue with heatmaps, but apparently also with thumbnails:

2022-12-29 18:28:48.081 [ERROR] [l.thing.UniFiProtectBaseThingHandler] - Failed to set thumbnail, event type not present: UniFiProtectEvent [type=motion, start=1672334914329, end=null, camera=6264180401bbcb0387005aca, score=100, id=63adce4701cc04038700b985, metadata=MetaData [objectType=null, objectCoords=null, objectConfidence=null], modelKey=event, partition=null, thumbnail=e-63adce4701cc04038700b985, heatmap=e-63adce4701cc04038700b985, smartDetectTypes=[], smartDetectEvents=[63adce4903b504038700b987]] or invalid heatmap: null
2022-12-29 18:28:48.103 [ERROR] [l.thing.UniFiProtectBaseThingHandler] - Failed to set heatmap, event type not present: UniFiProtectEvent [type=motion, start=1672334914329, end=null, camera=6264180401bbcb0387005aca, score=100, id=63adce4701cc04038700b985, metadata=MetaData [objectType=null, objectCoords=null, objectConfidence=null], modelKey=event, partition=null, thumbnail=e-63adce4701cc04038700b985, heatmap=e-63adce4701cc04038700b985, smartDetectTypes=[], smartDetectEvents=[63adce4903b504038700b987]] or invalid heatmap: null

This happens when someone is ringing. The DingDong is the only channel I have linked.

Thank you for creating this very usefull binding.

Any plans for adding support for the new G5 family of cameras?

Hi
Protect v 2.2.9
Unifi OS UCK G2 Plus 2.5.11
Camera G3 Instant
OpenHAB 3.4.2
Latest version of the binding.

On the IP adress of the cam in incognitode mode I can see with url http://192.168.1.227/snap.jpeg I can see a still image. If I refresh I see the new image.

I made an item of type image for the snapshot and the anonymous snapshot, I configured the switch for the snapshot, I enabled and disabled a snapshot folder, … All I get is a greyed out image. Tried the anonymous snapshot (enabled it), tried the snapshot, the last motion detection image… All i get is grayed out images.

I tried the snapshot URL as a oh-image card, to no avail…

I’m a little bit beyond imagination.

It’s just not clear to me what the actual function of the binding can be, as the only thing I want is when I call the page an actual view of what the camera sees, no video stream needed.

Edit: As for now I get the actual data from Last Motion and the camera name and in the openhab tmp folder (/var/lib/openhab/tmp) I got 1 image from the motion detection, don’t know how :slight_smile:

Did you ever got it to work? Seems like we’re in the same boat, diff program versions though…

Yes I can add support for G5, but I need the bootstrap.json to see what it looks like.
if you enable debug log, and send me the bootstrap.json as a privte message I can add support for G5.

In openHAB karaf console, enter the following command

log:set debug org.openhab.binding.unifiprotect

Set to info to undo:

log:set info org.openhab.binding.unifiprotect

BR S

It’s a bit hard for me to understand what the problem is. Possibly you can enable debug log and see what binding says. Also check the openhab log for error messages.

BR S

Just upgraded from a G4 Doorbell to a G4 Doorbell Pro, I am missing some doorbell channels.

Is the G4 Pro supported ? It doesautomatically auto discover as a G4Camera. Do I have to manually add it as a g4 Doorbell with the associated MAC address?

The main one i care about is the " is-ringing " channel.
This was my old G4 Doorbell:
unifiprotect:g4doorbell:UniFiProtect:D0xXxXxXxX:is-ringing

Now it detects it as a G4 Camera, not a G4 Doorbell.
unifiprotect:g4camera:UniFiProtect:ACxXxXxXxXxX

Binding is installed from the Community Marketplace, running openHAB 3.4.2 - Release Build

Thanks,

There is no support for G4 pro doorbell. I have added support in a pre-release, but never got confirmation that everything worked. I’ll try to dig up that build and you can test it out if you like?

BR S

If you can test it out, I can publish a new binding with support for g4dbpro