Custom Component: Unifi Protect

Autoplay hasn’t worked for me for a while now…on any camera that I stream (includes unifi and amcrest cameras). I’m not sure what version of HA this started with but if definitely not the latest. It is the same for my Android phones and my IPad. It only autoplays on my desktop.

Just an Fyi…so you know this is not unique to this unifi integration or to IOS devices

Hmm. Would be nice to get it working again!

Good to know you see the problem, too. Hope this gets sorted out soon!

Rolled back to Home Asisstant 0.112 from this summer, here it works perfectly. So it is a change between 0.112 and the current version.

The frontend issue can be found here: No autoplay of camera streams in lovelace anymore with unifi protect devices · Issue #8041 · home-assistant/frontend (github.com)

I’m interested in knowing a bit more about the delay that I’m seeing when viewing the cameras in HA via the live feed. For me, this is about 20 - 25 seconds.

The old integration for UVC didn’t have this issue in HA - I’ve just confirmed this with a camera that I haven’t migrated over to the Cloud Key Gen2+ yet.

I love the additional features that the Protect integration brings over UVC.

With all 3 of my Protect cameras (G4 bullet, G3 bullet, G3-Flex) I see about a 15 second live feed delay in HA (hosted in venv on an i3 NUC running Ubuntu linked to a UCK-G2+ within a GB lan).

This seems to be a HA not integration issue and may be linked to key frames based on my reading and (very) limited understanding - there’s a good discussion of the available camera platforms here that confirms early comments in this thread about it being linked to streams.

1 Like

Will there be any compatibility issues upgrading CKG2+ to v2.0.24 which is now Unifi OS?

https://community.ui.com/releases/UniFi-Cloud-Key-Firmware-2-0-24/b6684f1e-8542-4660-bc0b-74e0634448e8

No.
There are several posts about this in this thread.

You will have to reconfigure the integration to accommodate the port change that comes with the move to UnifiOS, or modify the raw configuration parameters within .storage.
Personally I removed and re-added the integration. Took about 10 minutes.

2 Likes

Cheers! Anytime I use a camera in a notification I use a mjpeg stream from motioneye or frigate. They are always realtime and minimal overhead on a Odroid N2+.

Thanks @TazUk - it’s good to know it’s not just me :slight_smile:

0.8.0

Released: January 9th, 2021

This release adds support for the new Ubiquiti Floodlight device. If found on your Protect Server, it will add a new entity type light, that will expose the Floodlight as a light entity and add support for turning on and off, plus adjustment of brightness.

There will also be support for the PIR motion sensor built-in to the Floodlight, and you will be able to adjust PIR settings and when to detect motion.

You must have UniFi Protect V1.17.0-beta.10+ installed for Floodlight Support. Below that version, you cannot add the Floodlight as a device to UniFi Protect.

THANK YOU again to @bdraco for helping with some of the code and for extensive code review. Without you, a lot of this would not have been possible.

  • ADDED: New light entity for each Floodlight found. You can use the normal light services to turn on and off. Be aware that brightness in the Protect App only accepts a number from 1-6, so when you adjust brightness from Lovelace or the Service, the number here will be converted to a number between 1 and 6.

  • ADDED: A Motion Sensor is created for each Floodlight attached. It will trigger motion despite the state of the Light. It will however not re-trigger until the time set in the Auto Shutoff Timer has passed.

  • ADDED: New service unifiprotect.light_settings. Please see the README file for details on this Service.

  • FIXED: Missing " in the Services description, prevented message to be displayed to the user. Thank you to @MarcJenningsUK for spotting and fixing this.

  • CHANGED: Bumped pyunifiprotect to 0.28.8

IMPORTANT: With the official FW 2.0.24 for the CloudKey+ all UniFi Protect Servers are now migrated to UniFiOS. So as of this release, there will be no more development on the Non UniFiOS features. What is there will still be working, but new features will only be tested on UniFiOS. We only have access to very limited HW to test on, so it is not possible to maintain HW for backwards compatability testing.

This release is tested on:

Tested means that either new features work on the below versions or they don’t introduce breaking changes.

  • CloudKey+ G2: FW Version 2.0.24 with Unifi Protect V1.17.0-beta.13

  • UDMP: FW Version 1.18.5 with Unifi Protect V1.17.0-beta.13

1 Like

@briis : Since this issue is seen by others (autoplay no longer working within Lovelace on iPads, possibly due to audio stream), could you recheck if it really works for you?
No autoplay of camera streams in lovelace anymore with unifi protect devices · Issue #8041 · home-assistant/frontend (github.com)
Thanks!

Hey.

I’ve been looking around for some projects to help out on and are waiting for some more Protect gear to arrive then i’ll be happy to help test (and develop once i get the hang of the process involved in HA dev).

My setup to arrive within a week that i can help out with the testing should be something like this:

  • 4 Bay Protect NVR (NVR-EU)
  • 1 pc UVC-G3-BULLET
  • 1 pc UVC-G3-FLEX
  • 1 pc UVC-G3-MICRO
    (more cameras will be added in time, first out the doorbell when available in Sweden)

I’m currently starting to get involved in some other projects so my time will be somewhat limited but happy to help out in any way I can when all the hardware has arrived, if interested?

Best Regards
Simon

I rechecked, and I now get the same behavior BUT only on my G3 series CAM’s. The G4’s all do livestreams in Lovelace. Again, all we do in the Integration is supply an RTSP address, so it must be the stream component in HA.
I am not the expert on streams, but I would assume that there must be a difference in how the RTSP stream is constructed in the G3’s vs. the G4’s since it work with the later.

The difference also shows when clicking on the image. The G4’s start playing immediately, where the G3’s need me to click on the play button.

Sounds great Simon. When you have your equipment setup, let me know where you would like to help out. Always love to get help.

Hey briis,
With the new Ubiquiti breach I have setup 2fa on my Ubiquiti account. Do you have any way of getting your integration to work with 2-factor authentication enabled on a Ubiquiti account?

This integration is purely local, so it is not using the Ubiquiti SSO. You create a local user that can only be used within your local network (or a VPN connection).

So 2FA is not supported, but also not needed.

2 Likes

Yeah, don’t know what happened but as soon as I changed my password for my Ubiquiti account and setup 2fa my integration stopped working. You are 100% right, I was able to get it working again just by adding the local user that I forgot I had setup. Not sure what happened but I am back up and working! Thanks

1 Like

I have had another user reporting this, so it seems that if you activate 2FA after you have created local users, the permissions for these users are reset to Non Admin mode, and you need to re-active the Admin permissions in the UniFi Protect App or Web.

@briis Would you be so kind and enter your experience in the bug report for Home Assistant as well? That way, the developers get a chance to fix the problem: https://github.com/home-assistant/frontend/issues/8041

Thanks!