Custom Component: Unifi Protect

Looks like I’m in a bit of bother here.

I already updated to Home Assistant 2022.2.5 and now I see the Protect is depreciated in HACS and moved to core. The instructions clearly say:

" You must remove the HACS integration efore upgrading to 2022.2.0 first to prevent a conflicting version of pyunifiprotect from being installed."

So where does that leave me? How to proceed?

I don’t mind clean deleting and reinstalling if needs must, as I’m currently only using the integration for the G4-Doorbell in one automation. I just need it to work.

Cheers!

Delete config/deps/pyunifiprotect to remove the conflicting dep. Then restart HA.

And make sure you also remove the HACS version before restarting as well. If you are coming from a version older then 0.11.x. you will need to rollback HA to 2021.12 and upgrade to at least 0.11 (preferably 0.12) test everything and then upgrade to 2022.2.

Since you missed the deprecated notice, please make sure you also review the 0.11.0 patchnotes as a lot of things were deprecated and removed for the HA core version.

1 Like

Thanks for the tips, just getting around to this point now. So I’m on 2022.2.5 as you know, and I’m now running HACS Protect version v0.12.0 (I upgraded from v0.11.4 as per instruction).

I don’t appear have any pyunifiprotect file in the deps directory (nothing in there in fact). I also did a search for the pyunifiprotect file $ find . -name "pyunifiprotect" , but didn’t return anything either.

I am in the same boat as you. I upgraded before deleting the HACS integration. The integration works, however, the ‘person’ detection doesn’t seem to be functioning.

On the Unifi app, I am getting accurate ‘person’ smart alerts, however, the object_detection sensor in the official integration doesn’t seem to be pulling in. Any thoughts?

Not often, but sometimes, I get notifications of movement on one of my outdoor G4s without Unifi showing anything in their app. So I get false alerts often (maybe always) with the object detected as “None” and no thumbnail attached.

Any idea why that might happen?

@AngellusMortis Happy Sunday sir. Hoping you can assist with getting Protect cameras integrated with the RtspWebrtc addon.

I kept getting stream errors once I added any of my Unifi cameras. After some playing around, I realized that when I edited the camera links in the RTSPWeb server addon, it was displaying the rtsps link. I always assumed the Protect integration used the non secure rtsp:// urls for the streams. I don’t believe that rtsps streams are compatible with webrtc.

Is there any way I can have the Protect integration use the rtsp stream instead? I realize that I can manually create these entities myself but it just feels unnecessary since I already have the streams being pulled in via the is awesome Protect integration. Any advice?

Use insecure ones which are disabled by default.

Thanks for that. Didn’t know there was a separate disabled camera feed.

Unfortunately I gave up on the addon once I realized it doesn’t support external access to the cameras without jumping through hoops. Reverted to the AlexxIT custom component.

Can I ask a question? How much delay you are seeing on Lovelace dashboard while these cameras are loading?

So I went ahead and deleted the HACS integration and rebooted HA as instructed. Protect was automagically added to the official integrations after rebooting. Nothing to worry about in the end. All working well (so far). Still no “pyunifiprotect” to be found no my system though.

Hmm, you’re right. Doesn’t appear to change state i.e. “none”.

From the patchnotes link @AngellusMortis provided, it does mention this as a “new” addition.

NEW: Added Detected Object sensor for cameras with smart detections. 
Values are none, person or vehicle. Contains event_score and 
event_thumb attributes.

Can’t really add much more than that to be honest. Please let us know if you get any further.

Anybody notice the feeds seem slower to load on the native integration vs previously on HACS? My cameras and HA are all hardwired so it’s not a wifi issue. I do have the high resolution rtsp feeds enabled but again, they were instantaneous on HACS. I can’t really quantify the slowness as consistent, sometimes just takes 5-15 seconds to load a stream now.

It might be because of the new stream encoding they added in 2022.2. It might take longer to load but should have lower latency. Not as good as Webrtc in my testing but much better than before 2022.2


We now enable Low Latency HLS (LL-HLS) by default to lower stream latency, thanks

It does work. If you are using logbook to check for changes, it will only report the most recent change for a given 1 minute interval. Meaning if your smart detection sensor goes from “none” to “person” and back to “none” in less than a minute, it will only report “none” in the logbook. Use the history instead of logbook for determining previous state.

If it is not updating, then that means you Websocket connection is not connected and you should check your logs.

All of the stream setup is handled by HA. Absolutely nothing changed for the streaming between HACS versions 0.11, 0.12 and the HA core version in the unifiprotect integration. 0.11 (vs. 0.10) added the multiple camera entities.

If something has changed in your HA install, it is likely something else that caused it. LL-HLS being enabled by default as part of 2022.2 as well is a very likely cause if you were not using LL-HLS previously. If you do not have a HTTP/2 proxy in front of your HA instance, the long load time be because of it trying to use LL-HLS, failing and then falling back to HLS.

Shout out to everyone involved in the core add-in! Installed and everything is working perfectly for rules detecting person and vehicle notifications! Am able to create all my rules and alerts!!! Even have internal camera’s enable/disable security mode via geofencing.

UI screwed the pooch when taking away multiple schedules to a single camera. But that is where this HA add-on comes in.

Next steps for me, to work in snip-its with the notifications.

I am trying to use motion detection to trigger lighting. It works great for about an hour, after that, it seems that most of the motion events are missed by HA and the lights do not activate.

Any tips on how how i can fix this.

@Quaface probably need a bit more information. To start, open the developer tool and filter the entities down to the motion sensor in question. Then select the info icon to see the history of activities. If you need to focus on a shorter period select ‘Show more’ and change the start and end date/time to focus on whatever period you need. Using this you can see if the motion sensor if failing or no longer detecting motion or it’s something else.

Hello, I am now using the new unifi integration and have a question about it, I want to stream when my G4 camera when it rang. What cheap ways would I have to display it to me on my dashboard? It is a mini pc with a monitor. Thanks a lot

I’m unaware of ability of PC operating systems to act as media players. There was software called ‘Google Cast for Educators’ that allowed MS Windows to present the Google Cast functionality to a network, but this is no longer available.

Usually if you want an automation to stream a camera to a display you would use a Google Cast (Audio and video) capable device. e.g. Google Nest Hub Max, even a Chromecast on a TV screen.

You might be able to use DLNA client software to turn your PC into a DLNA client. Best Windows 10 DLNA Client Download Free
DLNA Digital Media Renderer - Home Assistant