Custom Component: Unifi Protect

Per the thread and installation process first configuration should be easy but I can;t even login.
I met all prerequisites, I have UCKP with production OS 3.0.17.
In Local portal, admins section (now users are created there) I created non remote user.
I can login with local user account but configuring that in HA does not work. I have response wrong authentication. Any thoughts?

Update: Motion disable and Person/Vehicle working as expected.

With that said, I answered my own questions.


Quick question to answer I probably already now.

With Smart Detection now having its own identity, can Motion Detection be turned off within Unifi Protect?

I have UNVR and used to have UDMP. It seemed I had better luck catching the object using snapshot with UDMP than UNVR so I am not sure if this is the case for everyone. However, I have recently come to realize that the snapshots are created every 5 second or so. I tested this buy repeatedly calling the snapshot service and realized the timestamp on the snapshot is not updated.

My conclusion is that when you call the snapshot service, it is not taken in real time but whatever snapshot created most recently is sent to HA. If you have a detection that happens after the snapshot was created but before the next one was taken, you are going to end up with a picture without any object in it.

The proper way to get the actual snapshot is documented under the View section in UniFi Protect - Home Assistant. I automate using NodeRed so I was able to see the event id but not the unvr id. Even though the documentation says it’s the same as in config entry, it does not work when i simply type the name in (for me was unvr) but it turned out to be a 32 character long id. If you look at the post just above your from z11, it gives you an idea how to generate the link to get snapshot sent based on event, not the snapshot created every 5 seconds.

as such, for the photo path, it has to be in the form of “/api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}” It still does not solve the resolution issue, but I think at least it will be the actual event detection snapshot.

Thanks. I would like to get the thumbnail as an image file so I can attach it to telegram and not need to expose access to the unifi api to the internet. Does anyone have a working automation similar to the one I shared above using the snapshot service?

I see. In my case when the snap shot does not contain the detected object it’s generally taken in an earlier time. This gives an impression that the snap shot was delayed. I think you should pass along a time stamp in notification and figure out if the snapshot is taken before or after the time stamp (comparing to the unifi time stamp).

Within the current constraints of the system, perhaps passing two snapshots 5 seconds apart or add a slight delay before snapshot is fired to increase the chance that snapshot occur after detection. For mine I noticed it happens every 1 and 6 second, so maybe able to add some time condition too.

I am wondering what about passing an rtsp stream to create a camera entity in home assistant and take snapshot of the rtsp stream instead. That way you could bypass the unifi api and just use home assistant?

I am just curious whether this non real time snap shot is a constraint of unifi or home assistant.

My automation above uses the “normal” snapshot service from the stream and does not get the thumbnail from the unifi event - I would like to get that, though, as it should be taken at the exact point in time where the unifi event triggers. Anyway - it kind of works, so I haven’t spent too much time on improving…

I do not understand why my snapshots are low resolution though!

Hi Team
Anyone else seeing " set_doorbell_message is Deprecated" when running unifiprotect/dynamic_doorbell.yaml at master · briis/unifiprotect (github.com)? I have removed this blueprint, just wondering if others have encountered and plans to enhance with text.set_value service.
Thanks

Hey, what blueprint are you referring to?
I would like to test that as well, so I can get the short video clip instead of a static image.

Thanks

Have a look here:

This plugin is awesome! I only seem to have one minor issue… for some reason when I open Homekit and view the Unifi Protect camera stream over there it doesn’t render the livestream (it does render the preview and works in home assistant ootb). Does anyone have a clue what I misconfigured here?

edit: nvm I forgot to active my rtsp stream :sweat_smile:

Is there a way to get ID of the latest event for a camera? or indicate that I want to get the most recent one?

Another question. When I do a camera snapshot, it seems that it doesn’t give me a snapshot taken at the moment I call for it, but gets something that was taken several seconds ago. Is there a way to get a current snapshot?

Having a couple of issues for some time now.

  1. When the camera recording mode is set to “Never” the motion sensor is “unavailable”, but when set to either “Always” or “Detections”, they appear as available.

image

image

I use the inbuilt motion sensors for other automations and was wondering if there is a workaround? (besides using another form of sensor)

  1. There appears to be an obvious lag (~ +14 seconds) between the real time stream and what appears within HA. All my cameras are ethernet based. The “Pre-load” stream is enabled.

Thanks

Have a look at using go2rtc add-on, it will reduce the lag to near zero

2 Likes

@moderators Can this topic please be closed? This custom integration no longer exists and it is part of core now.

Can someone advise on how to pull Smart Detections thumbnails from media into automations? Not upon event but for let’s say last 24hrs? I can see them in media but have not found any ways to access the images form automations.

1 Like

Hey guys, I am having a terrible time getting the G4 Doorbell Bro integrated into HomeKit. No matter what I do I cannot get the video to show up there. I have it in HA. I have it exposed to HomeKit, I have tried the setting about the H.264 setting. I have enabled RTSP in the UI Settings. Nothing seems to work?

The HACS custom integration for UniFi Protect is dead and gone. Stop posting in this thread.

If you have a question about official integrations, post in the configuration category.

Big thank you. Very useful integration. I love the notification feature of protect when I am away. It shows me instantly the cam and I can view the clip when someone approaches my house. Is there a way to turn off/on notification … e.g. when at home turn it off … when away … turn it on via an HA automation?

Currently having an issue,

When i create a picture component for my cameras and click “Live” View. Cameras load up fine and work fine. However, after a random amount of time. The feed freezes and i get an error “Stream Never Started”. What could be causing this and is there any fix?

If i put the component in “Auto” Mode and then only view the cameras by clicking on them i do not seem to have this issue (i have just enabled it so maybe i will just going to leave it for a bit and will let you know).

Any advice is appreciated!

Crossing Line Detection - Available?

Hi. I’m hoping that someone can point me in the correct direction please. There is a Smart Detection "Cross Line’’ capability in UniFi Protect, where a smart (person/vehicle/animal) detection is made if crossing a line created in the protect camera config.

I’d like to get this Cross Line detection in Home Assistant, separate from other smart/person/vehicle detection (i.e. to know that the vehicle is inside the driveway, rather than outside). Is this possible please?

Note: I do have smart detections working in Home Assistant already, I’m hoping there is a way to separate Cross Line detections from general smart detections. I have searched around for info on this, but can’t seem to find …

Thanks