Custom Component: Unifi Protect

Is there any way to set a timeout or similar when unifi data is requested? I’ve seen the following happen twice today… In the logbook all my unifi stuff moves to Unavailable for 3 seconds before returning to correct status… Makes a few of my automations do some funky stuff as well…

2020-07-29 13:18:47 ERROR (MainThread) [custom_components.unifiprotect] Error requesting unifiprotect data: None
2020-07-29 13:18:50 INFO (MainThread) [custom_components.unifiprotect] Fetching unifiprotect data recovered

Has anyone played around with automations for the G4 Doorbell? I’ve got a Node Red flow going to 1) make an announcement on my Echo Show and 2) take a camera snapshot and send as a push notification to iOS upon button press.

I did try to send the live video stream within the push notification, which worked, but the video was almost 15 seconds behind “real time” which isn’t too useful for a doorbell use case.

Really interested in any other creative things people are thinking about doing with their G4 doorbells!

Yup! If my office Hue lights are on, they flash red five times when the doorbell is rang, then go back to the previous setting.

1 Like

I found this component a few weeks ago and it is awesome! It opens up so many possibilities. Thank you all for posting your automations! I was able to add the push notification with thumbnails and some other nice features. I do have a few things I can’t figure out.

  1. Thumbnails on my phone are super small. I’ve tried to play with sizing but nothing changes. What am I missing.

  2. I only get the thumbnail from in home. I have Nabu Casa enabled, but still never get them from away.

  3. Sometimes I get the thumbnail on my apple watch and other times not. It’s about 1 of 3 times. Any ideas?

I can not for the life of me get my RTSP streams from any of my Unifi Protect Cameras to be a real-time stream with this custom component.

Using the picture entity card it loads 15 seconds in the future even with the mode set to Live. Not very helpful for a security system. I have tried the preload checkbox but doesn’t seem to make any difference.

Everything else in this integration works great.

This issue has been mentioned a few times, and unfortunately, there is nothing I can do about it. Other cameras supply a different stream type, so you can tweak the buffers etc. But Unifi Protect currently only supplies live streams as an RTSP feed, where you cannot tweak anything. I have the same experience on my system.
If anyone with more video stream experience than me, has some clues how we could fix this, I would be happy to hear from them.

I don’t think it’s a great solution, but what I found is if you install the MotionEye add-on to bring the video in from the UniFi cameras via the RTSP feed, and then use the MotionEye feed and create mjpeg cameras in HA you get a live feed. Overhead doesn’t seem too bad as I’ve turned off motion detection in MotionEye.

Yeah, I don’t use this for camera feeds. I just setup a generic camera with the rtsp address through homeassistant. Don’t enable the “stream” feature, and it should stay live. Not sure why stream breaks that currently.

Unifi protect does not show up

Hello Bjarne.
I love the work you have done here, but this trick does not help on my instalation.
You got any tips?
I do find the Ubiquiti UniFi addon.
Home Assistant 0.114.2
Skål fra Norge!!!

Hej
How did you install it? Through HACS? Try to clear the Cache of the Browser.

Hi.
It is in a docker container on a NAS.
Yeah did clear cache, and also two different browsers.
Thank you for your effort.
Regards

Strange…
Just to make absolutely sure (and you might have done this already):

  1. You have installed the Unifi Protect Integration through HACS, and if you browse the custom_components directory you have a unifi_protect directory with files in it, and one of them is config_flow.py
  2. Click the Settings Tab on the left side
  3. Click Integrations
  4. When on THIS page, force refresh your browser
  5. Click the + Sign in the bottom right, and search for Unifi Protect

With this, is the Integration still not showing?

Aha, sorry. thought it was native included in the distro.
So i missed out on the need to add it manualy before enabeling it. Sorry about that.
Il look into tonight.

1 Like

I have not come to the point of making this an official component yet. But hopefully one day, I will figure out how to setup tests and such, and then make a PR.

2 Likes

Thank you for guidance. Works like a charm.
Now some testing.
Have a great day.

Release 0.5.5 is out

The latest beta of Unifi Protect includes the start of Ubiquiti’s version of AI, and introduces a concept called Smart Detect, which currently can identify People on specific Camera models. When this is enabled on a Camera, the event type changes from a motion event to a smartdetect event, and as such these cameras will no longer trigger motion events.

This release is a quick fix for the people who have upgraded to the latest Unifi Protect Beta version. I will later introduce more Integration features based on these new Unifi Protect features.

It should show in HACS as an update.

2 Likes

Hi Bjarne,

That’s amazing and also needed by Ubiquiti.
Do you have a link where the program of what devices that will be included?

You have to be registered as Beta Tester with Ubiquiti to see the release notes for the Beta software. But aside from that, it is not mentioned anywhere I have seen. I have 2 x G4 Pro, 2 x G3 Flex and 1 x G3 Micro, and only the G4 cameras support Smart Detect at present. I also believe that the Doorbell supports it, but cannot test that.

EDIT: Just found a line stating that current only the G4 Series of Cameras is supported. Which fits with my observations.

Hi, I have just installed the integration and everything works fine as expected, thanks a lot for the great work.
However, I have one question; When I add the camera to lovelace then the live preview refreshes the image every 10 seconds, is there a way to get a permanent livestream somehow ?
That would be great! Thanks a lot!

Not currently, see Custom Component: Unifi Protect