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

Is it working now, the camera? If it is working then no, otherwise you can send it to me :grinning:.

Best regards s

Yes, thanks, the camera is working now. Really exciting to have this binding.

Additional question: I noticed that the Motion Thumbnail is not being refreshed vor every motion detection. For example, the camera has detected and recorded motion at 13:25 but the Motion Thumbnail is still from 12:43 (where also motion was detected and recorded). The time now is 14:08.

Anything in the logs? The binding will query the NVR for the Image upon motion, sometimes it takes a while for the image to be stored correctly. I have a todo to look at retires for fetching the picture. Sometimes it fails. Out of interest is the thumbnail visible in the Protect ap under recent motion events?

I will send you a pm with logs.

Today, the binding stopped getting updates from Protect. I see no exception in the log. I did not have DEBUG log level on. But I see that used storage number and last motion timestamp are old.
So I enabled DEBUG log level now and I only see these lines every now and then:

2022-03-27 17:39:04.725 [DEBUG] [hing.UniFiProtectThingHandlerFactory] - bundle org.openhab.binding.unifiprotect:3.2.0.202112072046 (279)[org.openhab.binding.unifiprotect.internal.thing.UniFiProtectThingHandlerFactory(352)] : Querying state active
2022-03-27 17:39:22.149 [DEBUG] [hing.UniFiProtectThingHandlerFactory] - bundle org.openhab.binding.unifiprotect:3.2.0.202112072046 (279)[org.openhab.binding.unifiprotect.internal.thing.UniFiProtectThingHandlerFactory(352)] : Querying state active

After I restarted the binding (restart org.openhab.binding.unifiprotect), updates are working again.

I just installed this amazing binding after installing the UDM Pro/G4 doorbell. I was hoping someone could provide some guidance regarding the following messages observed in the logs. I searched through this posting but only found one instance of this message.

I honestly have no interest in the heatmap nor acquiring or displaying the image so the question is how to suppress this log entry/error|warning ? I’m sure its something simple so any assistance is appreciated.

345 x Active x  80 x 3.2.0.202112072046    x openHAB Add-ons :: Bundles :: UniFi Protect Binding
13:39:43.178 [WARN ] [rotect.internal.model.UniFiProtectNvr] - Heatmap request resulted in a error size image
13:39:43.202 [WARN ] [rotect.internal.model.UniFiProtectNvr] - Heatmap request resulted in a error size image
13:39:43.204 [ERROR] [al.thing.UniFiProtectBaseThingHandler] - Failed to set heatmap, event type not present: UniFiProtectEvent [type=motion, start=1650829174417, end=null, camera=removed, score=100, id=removed, metadata=MetaData [objectType=null, objectCoords=null, objectConfidence=null], modelKey=event, partition=null, thumbnail=e-removed, heatmap=e-removed, smartDetectTypes=[], smartDetectEvents=] or invalid heatmap: null

I’ll see if I can adjust logging. Can change it to debug. Ideally you should not get those error.

Much appreciated.

Its odd because I’m not observing this warning/error on every motion event regardless of the type (motion/smart). The error itself doesn’t lend to a root cause so I’m not sure what/if anything I can adjust on my end (i.e. suppressing heat maps all together). I’m adding details regarding my OH build and the hmap.png file below as It may/may not help.

– Monika

-rw-r--r-- 1 openhab openhab   779 Apr 25 18:55 60ef7e960128380387004275-motion-hmap.png

Version:     3.2.0 (Build)

User:         (Active Process 5272
26362)
User Groups:

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab          | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab/runtime  | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab            | openhab:openhab
             OPENHAB_CONF     | /etc/openhab                | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab            | openhab:openhab
             OPENHAB_BACKUPS  | /var/lib/openhab/backups    | openhab:openhab

I have another quick question I hope you don’t mind answering. I noticed we have a series of items that allow for a custom LCD message to be displayed on the G4 doorbell.

In my testing, I do not have a default (Thing config.; lcdCustomMessage) defined so I’m utilizing the items directly. I have the following 2 items/channels defined for my test.

string { channel="unifiprotect:g4doorbell:property:garageDoorbell:lcd-custom-text" }
switch { channel="unifiprotect:g4doorbell:property:garageDoorbell:lcd-custom" }

When the switch is set to ‘OFF’, I can define the string as needed. However, when the switch is set to ‘ON’, the dynamic state is blocked and the string value set will return to its previous value after a few seconds. Can someone please confirm that I’m using this properly. I expected that I could dynamically define the message in a rule without having to toggle the switch off, set the string then toggle the switch back on.

I also noticed there is another item placed in the documentation. This has no associated channel so I’m not sure if it was a copy/paste issue or just needs to be removed in lieu of the string defined above.

Switch  G4DBSetCustomMessage "G4DB Set Custom message" (G4DB)

All in all this is an amazing binding. Much appreciated.

–Monika

So the idea was to provide multiple ways of setting the lcd message:

  • LCD_DO_NOT_DISTURB - Uses the built in UniFiP do not disturb icon (you can’t set the actual message, it will always be Do Not Disturb or similar)
  • LCD_LEAVE_PACKAGE - Uses built in built in icon for package and the message leave package at door (message can’t be changed)
  • LCD_CUSTOM This is a switch item channel if set to ON it will use the message in the configuration of the doorbell (you can edit that config on the thing in the GUI)
  • LCD_CUSTOM_TEXT This is a String Type channel, When you use this channel the text on the lcd will be updated. So this can be used a bit more dynamically from rules.

Thank you for your response. So can you confirm that its expected that I:

[1] Toggle the switch (lcd-custom) OFF.
[2] Set the string (lcd-custom-text).
[3] Toggle the switch (lcd-custom) ON.

With other bindings (AlarmDecoder ‘Keypad’ command for instance), I simply set the value of the string (via rule) and the channel handles the conversation. Perhaps the current switch can apply to just the default (defined @ the Thing) overriding the string item (just a thought). Please let me know if I’m just using/interpreting use incorrectly so please feel free to correct me.

You should not have to toggle the switch. The switch is only related to the pre configurable message.
In other words. As soon as you update the lcd-custom-text, the text should appear on your doorbell, you don’t have to toggle any switch.
At least that is the idea, I have not tested the channel in awhile.

This makes me feel better. Let me re-run the test and I’ll post the debug logs. Thanks again for quickly responding. I totally appreciate it.

I tested this myself, I stand corrected. I’ll try and change this behavior in the next release.
I don’t think there is any need for toggling.

1 Like

I was just sitting down to test, thank you for the update … Yes, no need for toggling, I assume that if the string is null’d then the default value (if set in the Thing) would apply.

How to implement the actually motion thumbnail to the sitemap ? How does this code look like?

Is the binding already compatible with Protect 2.0.0? I think Homeassistant developers had to change something.

Yes it is compatible with 2.0.0. I’m running on fw 2.4.0 right now.
2.0.0 was released a long time a go and it was a big change for the UCK2P since it was a change to UniFiOS. The support has been there since ALPHA5 released in may 2021.

Regards S

This is what my sitemap looks like:

 Group item=sUniFiProtect label="UniFi Protect" icon="unifiprotecticon" {
            Group item=gUniFiProtectMotion label="UniFi Protect Motion" icon="motion" {
                Text item=G3DULLastMotion
                Image item=G3DULMotionThumbnail
                Text item=G3DLRLastMotion
                Image item=G3DLRMotionThumbnail 
            }
        }

Where the last motion display a date string when last motion was triggered

DateTime G3DULLastMotion            "G3DUL Last Motion [%1$tY.%1$tm.%1$td %1$tH:%1$tM]" <timestamp>  (gG3DUL) { channel="unifiprotect:g3camera:e7d2e32c:7483C22FA4A5:last-motion" }
1 Like

I am not talking about the UCK2P firmware, but about the Protect application. 2.0.0 was released just 10 days ago.