Ubiquiti Unifi Protect cameras

This is amazing stuff. I have a single camera outside the Ubiquity Protect system that I use just to trigger things on motion. I think I may be able to finally replace that old camera.

Curious if Motion Zone support would be added in the future? Looks like "motionZones" info is coming from the controller into Hubitat (assuming I am interpreting that correctly). Would be nice to only trigger things if the motion came from a specific Motion Zone.

1 Like

Thanks, I'm glad you like it.

Unfortunately the zone information is not in the event data that comes back from UniFi Protect.

The motionZones that you see reported comes from an API query that provides it as more static and informational.

The real time event data reflects any motion in any zone as motion by that camera.

Ah bummer. Was worth asking anyway. :stuck_out_tongue:

Thanks again for doing this - great stuff.

1 Like

I like the suggestion and can definitely see the usefulness. If UniFi Protect ever adds that I will definitely support it.

2 Likes

Been using your drivers for a while now, and just noticed that my door bell can capture images. Do you know how to get access to send these images via email when captured? (Using WebCore) and are these images stored on the habitat directly or on the unifi protect. Want to make sure that if I have it capture on movement I don't fill up my hubitat as I see no way to delete images.

The images are stored as attributes on the virtual device in Hubitat.

You can reduce the attribute history length on the device page, which will limit the number of images that will be stored in the event history (and therefore limit how much of the hub storage might be consumed). You can also adjust the image size to be smaller in the virtual device preferences, which would also help limit the storage consumed.

As for sending them using webcore, I'm not familiar with how it works. Can you point me to an example of how you send images through email from another driver type?

There are a couple of ways to get the image data from a device, but I'll have to see how webcore wants to retrieve the image data for sending.

1 Like

Good to know. And I dont have an example of webcore sending an image. Intried grabing the displayimage but that did not work. (Also can live without if need be)

Also i tried to get the image to appear in hubitat dashboard but it never shows. Keeps telling me to select an attribute. I tried image and also displayimage. But no go. I can see the image in the device setting. But cant seem to pull it to show anywhere.

Also love your work on this. I have been so thrilled with it and now the person detection working on the doorbell is awesome as i have it anoince that someone was detected as delivery drivers never ring or knock.

1 Like

The issue with a dashboard view is that the contents of the image attribute will overflow the allowed number of characters for a dashboard tile, so it just displays nothing.

In order to work around it, I made an app to act as an image server for use with dashboards. Here's a description of how to try that out: Ubiquiti Unifi Protect cameras - #127 by tomw

LOL. It was a year ago i had thay working and had to redo my hub with the new version they made. And completely forgot i had it working somewhat. I will have to go back and read that post and what i tried back then.

Cant belive i forgot. LOL. Tha ks for poi ting me there.

:slight_smile:

1 Like

No worries, it was easy to forget about. Maybe I should make it part of the real package, since until now I wasn't sure if anybody other than me was actually using the image server app. :wink:

1 Like

I got it working. :slight_smile: Thanks

1 Like

@tomw, So I just upgraded to the Unifi NVR (Standalone) instead of the UDM Pro, and I notice it does not respond as quickly with the driver, I can access the cameras, grab snapshots (randomly some times), and detect motion, however it slow to respond, and notice there are errors in my log for the parent driver. Any chance you have anyone else using the UNVR and solved the issue?

It seems its when it trys and takes a picture, never shows up in the event log that take was ever pressed. and nothing shows, (Yes I have the option turned on in the camera setting)

And now I think I have tried to many times and the unvr has locked me out with the hubitat user I created.

Let me know if there is anything I can do to help.

dev:8252022-12-13 01:08:54.394 AMerrorgroovyx.net.http.HttpResponseException: status code: 403, reason phrase: Forbidden on line 583 (method httpExecWithAuthCheck)
dev:8252022-12-13 01:08:54.385 AMdebughttpPatchExec() failed: status code: 403, reason phrase: Forbidden
dev:8252022-12-13 01:08:51.954 AMerrorgroovyx.net.http.HttpResponseException: status code: 403, reason phrase: Forbidden on line 583 (method httpExecWithAuthCheck)
dev:8252022-12-13 01:08:51.945 AMdebughttpPatchExec() failed: status code: 403, reason phrase: Forbidden
dev:8252022-12-13 01:08:42.860 AMerrorgroovyx.net.http.HttpResponseException: status code: 403, reason phrase: Forbidden on line 583 (method httpExecWithAuthCheck)
dev:8252022-12-13 01:08:42.852 AMdebughttpPatchExec() failed: status code: 403, reason phrase: Forbidden
dev:8252022-12-13 01:08:40.529 AMerrorgroovyx.net.http.HttpResponseException: status code: 403, reason phrase: Forbidden on line 583 (method httpExecWithAuthCheck)
dev:8252022-12-13 01:08:40.519 AMdebughttpPatchExec() failed: status code: 403, reason phrase: Forbidden
dev:8252022-12-13 01:08:23.465 AMerrorgroovy.lang.MissingMethodException: No signature of method: java.net.SocketTimeoutException.getResponse() is applicable for argument types: () values: [] Possible solutions: getMessage() on line 645 (method httpExecWithAuthCheck)
dev:8252022-12-13 01:08:23.452 AMdebughttpGetExec() failed: Read timed out

Also under the parent ID I see a few errors and unknown:

Current States
Driver Name : UnifiProtectAPI
Driver Version : 0.2.12
Last Refresh : Tue Dec 13 00:45:08 MST 2022
Status : Bootstrap Page not found error
WebSocket Status : Unknown
commStatus : good
State Variables
Status : Bootstrap Page not found error
expir : 1670921823
Last Refresh : 2022-12-13T07:45:08+0000

Hi @albertjmulder, it looks to me like you might have created the account in UniFi OS but did not give permissions to the UniFi Protect app itself. Please let me know if this does not help:




Also under the parent ID I see a few errors and unknown:

Also, some of that data is not from my driver. I would recommend clearing out those stale state variables (switch the device type to "Device" and click "delete all state variables", then switch the device back to my driver) and then run Initialize again on the UniFi Protect Controller virtual device.

One more thought -- "View Only" will work for motion detection events and taking snapshots and such. If you want to adjust settings (like changing the recording mode or turning the LED on or off), you have to have a "Full Management" permission for the role that the account is set to.

Its defiantly set to view profile, and I did the device then delete and then tried again same issue, so I did it again but instead of turning it back , I deleted all child devices and then the parent device, and re created it and still have issues.

Log:

When trying to take a pic:

dev:8402022-12-13 02:23:13.131 PMerrorgroovy.lang.MissingMethodException: No signature of method: java.net.SocketTimeoutException.getResponse() is applicable for argument types: () values: [] Possible solutions: getMessage() on line 645 (method httpExecWithAuthCheck)
dev:8402022-12-13 02:23:13.111 PMdebughttpGetExec() failed: Read timed out

And it is setup for snapshots
image

Issues in Parent Driver with issues has went away.

But still slow to respond to motion notifications and picture option not working.

That interface looks a little bit different than my UniFi OS one. What are the app settings for that Viewer role that the 'hubitat' user is assigned to. It is probably viewer for all apps, but just want to be sure.

re: "Enable Anonymous Snapshot", that is not the same interface as is used by take on the child driver. Even if that setting is disabled, it should still work from the child driver.

What version of UniFi OS are you using?

image

Note this is on the NVR (Unifi Stand Alone Device, not the UMD Pro) And its up to date on all software.

I'm going to PM you to troubleshoot more.

1 Like

@albertjmulder ended up having some kind of networking issue between the cameras and NVR that needed to be sorted out. Getting the cobwebs out of a system upgrade is always the fun part. If it just worked, would you feel like you really got your money's worth out of the upgrade? :smiley:

1 Like