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

I’ll give it a go and let you know. Removed Doorbell, Binding, and reinstalled new one in addons and inbox instantly noiticed G4 Pro as a doorbell. I’ll test channels and let you know if i have any problems!

1 Like

So I tried a binch of things and these were my findings… most things seem to work, some do not and throw errors when trying to change them from the OpenHAB side of things.


name						R (working)
type						R (working)
host						R (working)
state						R (working)
up-since					R (working)
last-seen					R (working)
connected-since				R (working)
last-motion					R (working)
mic-volume					R (working)
is-mic-enabled				R (didnt try)
is-dark						R (working)
is-recording				R (working)       
is-motion-detected			R (working)
status-light				R/W (didnt try)
reboot						R/W (did not work)
hdr-mode					R/W (didnt try)
high-fps-mode				R/W (didnt try)
ir-mode						R/W ( read works, write does not)
recording-mode				R/W ( read works, write does not)
a-snapshot					R/W (didnt try)
a-snapshot-img				R (didnt try)
snapshot					R/W (didnt try)
snapshot-img				R (didnt try)
motion-thumbnail			R (working)
motion-heatmap				R (working)
motion-score				R (working)
lcd-leave-package			R/W (read works, write does not)
lcd-do-not-disturb			R/W (read works, write does not)
?? lcd-custom 				(No Longer Supported?)
lcd-custom-text				R/W(not working)
is-ringing					R/W (read works)
last-ring					R/W (read works)
ring-thumbnail				R/W (working)
smart-detect-package		R/W (did not work, did not see on documentation but is in thing channel)
smart-detect-person			R/W (read works, write does not)
smart-detect-vehicle		R/W (read works, write does not)
smart-detect-motion			R (not working)
smart-detect-thumbnail		R (working)
smart-detect-score			R (working)
smart-detect-type			R (working)
smart-detect-last			R (not working)

Here were the errors from a couple things that I tried, one was “reboot”, another was trying to set the custom text “lcd-custom-text”



2023-03-14 17:24:09.068 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_CustomMessageText' changed from Test 1 to Hello
2023-03-14 17:24:09.069 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG4DoorbellThingHandler@16e784fb': Unresolved compilation problem: 
	The method handleSmartDetectPackage(UniFiProtectCamera, ChannelUID, Command) is undefined for the type UniFiProtectG4DoorbellThingHandler
	The method handleSmartDetectPackage(UniFiProtectCamera, ChannelUID, Command) is undefined for the type UniFiProtectG4DoorbellThingHandler
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG4DoorbellThingHandler.handleCommand(UniFiProtectG4DoorbellThingHandler.java:122) ~[?:?]
	
	
	2023-03-14 17:11:17.266 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_Reboot' changed from OFF to ON
2023-03-14 17:11:17.267 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG4DoorbellThingHandler@16e784fb': Unresolved compilation problem: 
	The method handleSmartDetectPackage(UniFiProtectCamera, ChannelUID, Command) is undefined for the type UniFiProtectG4DoorbellThingHandler
	The method handleSmartDetectPackage(UniFiProtectCamera, ChannelUID, Command) is undefined for the type UniFiProtectG4DoorbellThingHandler
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG4DoorbellThingHandler.handleCommand(UniFiProtectG4DoorbellThingHandler.java:122) ~[?:?]

Thanks for all you’re doing on this binding!

When I saved my items file, a bunch of errors came up. about the G4 Doorbell

G4 Doorbell errors.txt (162.4 KB)

I’ve fixed smart-detect-package (or I hope I have)

You will have to remove and readd the thing. Some of the error above should be gone as well.
The leave package and lcd-custom I can test out myself, it might be that the api has been changed in the latest versions.

BR S

Same issue here - Things get no updates, even though there are updates for my G4DB

Frame: {“action”:“update”,“newUpdateId”:“b1d66a17-b66d-4313-9cf1-97aa48130f1d”,“modelKey”:“camera”,“id”:“63456af402eed10387002ccc”,“mac”:“68D79XXXXXX”,“token”:null}

Triple checked the MAC, but that’s not it.
OH 3.2.0
Unifi Protect 2.2.11
UDM Pro 2.4.27

You should check your item definitions for lcd-custom-text as it was recently refactored. For me with a regular g4door bell (non pro) it works.

lcd-custom-text 	String 	Channel for setting custom lcd messages 	Read/Write

Description
The LCD message displayed by the doorbell will either be the configured message in the thing configuration or the set message in the lcd-custom-text channel. Use the thing config if you want a static custom message to be displayed. Use the lcd-custom-text channel if you want to dynamically set the message.

In case that is not working, you would have to supply error logs with the latest binding I supplied above.

BR S

I’m running
UniFi OS 3.0.17
UniFi Protect 2.7.33
Openhab 3.4.0

I would try to upgrade to latest stable UniFi OS and Protect app, and then OpenHAB 3.4 (at least to test).
Are you also sure you have linked correct items to channels? Otherwise you have to run latest version of binding and enable debug logging. Send a PM with the logs to me and I can take a close look.

BR S

That updated binding, fixed those errors. It made the lcd commands work, made the person and vehicle smart detects work properly too.

It appears the smart-detect-package still is not working.

When changing using person or vehicle, it works how it should.


2023-03-16 16:33:26.514 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'DoorbellPro_SmartDetectVehicle' received command ON
2023-03-16 16:33:26.515 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'DoorbellPro_SmartDetectVehicle' predicted to become ON
2023-03-16 16:33:26.516 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DoorbellPro_SmartDetectVehicle' changed from OFF to ON
==> /var/log/openhab/openhab.log <==
2023-03-16 16:33:26.518 [INFO ] [ing.UniFiProtectG4CameraThingHandler] - Sending turn on/off SmatDetect Settings: VEHICLE camera: Doorbell, ip: 192.168.5.29
==> /var/log/openhab/events.log <==
2023-03-16 16:33:28.170 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'DoorbellPro_SmartDetectPerson' received command ON
2023-03-16 16:33:28.171 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'DoorbellPro_SmartDetectPerson' predicted to become ON
2023-03-16 16:33:28.173 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'DoorbellPro_SmartDetectPerson' changed from OFF to ON
==> /var/log/openhab/openhab.log <==
2023-03-16 16:33:28.174 [INFO ] [ing.UniFiProtectG4CameraThingHandler] - Sending turn on/off SmatDetect Settings: PERSON_AND_VEHICLE camera: Doorbell, ip: 192.168.5.29

When doing package, it does not do anything like the above working commands…

2023-03-16 16:35:58.990 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'DoorbellPro_SmartDetectPackage' received command ON
2023-03-16 16:35:58.991 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'DoorbellPro_SmartDetectPackage' predicted to become OFF

One small thing that I noticed was that the binding auto discover thought it was a g4camera again, and not a g4 doorbell. I just manually added it as a doorbell and everything seems to be working properly,

Thanks for the quick updates and work !

Updating to Openhab 3.4.2 did the trick! Thanks, @Seaside !

1 Like

I’ll have another look at that.

That’s strange. That code has not been changed. Would you mind sending me the bootrap.json and I could verify against that? You get it by enabling debug log and it will store it to a file (The location of the file is printed in the debug log). Send as PM in that case.

BR S

You can try a pre-release for g5:

  • Remove any old binding
  • Drop jar in addons folder
  • Readd any cameras

BR S

When I did a manual discovery scan in the UniFi Protect binding, the g4camera turned into the g4doorbell.

Seems to be working now. I did restart OpenHAB when I removed and re-installed the new biding. Maybe something was not lining up when updating to the new binding without a restart.

1 Like

New BETA9 relase

  • Basic support for G5-cameras
  • Support for G4 Doorbell Pro
  • Smoke / CO smart detections for G4/G5 cameras
  • Package smart detection for G4/G5 cameras
  • Enable/disable status sounds G4 Doorbell / Pro
  • Motion Detection / Enable & Disable

Hey, I just updated to OH 4.0.0.M1, pretty much every other binding I am using has a 4.x release (some are still SNAPSHOT but working nonetheless). I can’t find a 4.x branch for unifiprotect though. Beta9 installs and runs, and the things get initialized, but there are some errors in the logs:

23:48:34.636 [WARN ] [.core.thing.internal.ThingManagerImpl] - Channel types or config descriptions for thing 'unifiprotect:g4doorbell:5984f96605:64be206107' are missing in the respective registry for more than 120s. This should be fixed in the binding.
23:48:34.641 [WARN ] [.core.thing.internal.ThingManagerImpl] - Failed to normalize configuration for thing 'unifiprotect:g4doorbell:5984f96605:64be206107': {thing/channel=Type description for {0} not found although we checked the presence before.}
23:48:34.645 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:g4doorbell:5984f96605:64be206107' changed from UNINITIALIZED (NOT_YET_READY) to INITIALIZING
23:48:34.651 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:g4doorbell:5984f96605:64be206107' changed from INITIALIZING to ONLINE
23:48:34.952 [WARN ] [ommon.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.UniFiProtectG4CameraThingHandler.refreshChannel(UniFiProtectG4CameraThingHandler.java:83) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG4DoorbellThingHandler.refreshChannel(UniFiProtectG4DoorbellThingHandler.java:80) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectBaseThingHandler.refresh(UniFiProtectBaseThingHandler.java:103) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG4CameraThingHandler.refresh(UniFiProtectG4CameraThingHandler.java:72) ~[?:?]
	at org.openhab.binding.unifiprotect.internal.thing.UniFiProtectG4DoorbellThingHandler.refresh(UniFiProtectG4DoorbellThingHandler.java:74) ~[?:?]
	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) ~[?:?]

I’m assuming that a 4.x binding is in the works, any timeline on that?

edit: Just to be clear, the current binding does seem to work on OH4 even with those errors in the logs, so I’m not really missing any functionality.

There is no 4.x.x version of this binding. It has to be created first. I don’t have any timeline on when it can be ready. I will probably support v3 and v4 for some time and when v4 is released I will only maintain and update the v4 binding.

Best regards s

I have built and done some basic testing for openHAB 4.
You will have to install it manually: Release unifiprotect-4.0.0-BETA9 · seaside1/unifiprotect · GitHub

BR S

Sorry, I am fairly new at this. I’ve tried to add it manually to the addons folder, but I am denied permission to do so. If it’s not too much trouble, could you guide me on how to add it manually to the installation?

I’m running my Openhab installation on a standard Raspbian system.

Thanks so much in advance.

If you are new at this. I would recommend you to run openHAB 3 until 4 is more stable.

You just put the jar file in the addons folder:

So far so good, works for me. Thanks.

Also, for anyone that is trying to install it, the easiest way to do it is through the Karaf console.

openhab@localhost bundle:uninstall org.openhab.binding.unifiprotect
openhab@localhost bundle:install https://github.com/seaside1/unifiprotect/releases/download/unifiprotect-4.0.0-BETA9/org.openhab.binding.unifiprotect-4.0.0-BETA9.jar
openhab@localhost bundle:start org.openhab.binding.unifiprotect

Hi there!

just a short question. How can I set the quality of the snapshot image. In my case the snapshot image ist mostly a bit pixelated. So is there a way to configure the snapshot quality?

cheers
Andreas