Custom Component: Unifi Protect

Sorry if this already answered here but there are a lot of posts and searching for add-on didn’t really give any definitive results.
Is there a Unifi Protect as an add-on?
I know there’s the controller add-on, but that’s separate.
I found this, so it makes me think it’s quite possible:

I know my performance might not be great but I kind of want to try this all out before I commit to any more hardware than just the camera.

Very surprised to see an option to install Protect in docker. My understanding is that Protect requires a “console” to function. And the only available ones that I know of are the UDMP, an NVR or the USG CK2.

I doubt the Protect app is supported outside of Unifi hardware so I’d be worried about investing money into the cameras, only to have the Protect app break because of changes made by Unifi.

Just my 2c.

Eh that’s what returns are for?
It’s not an investment until the return window is closed.
My Amcrest just went back because it’s not as reliable as the Nest, just a little more tweakable.
I almost have the container working.
We’ll see if I can add the doorbell.

1 Like

Kinda stuck on this issue where it says it’s connecting to the NVR but it’s just stuck there.

I guess UniFi is looking off the table. Amcrest doorbell was not good as a doorbell. Nest subscription is annoying but at least good as a doorbell.
About to just put a basic button there with a creepy camera in the roof of my porch…

Keith, I have the Unifi doorbell. PM me with any questions you have. I love it.

1 Like

Got something cool working using this integration: Unifi Doorbell G4 last snapshot casted to Google Home via intermediate docker image (e.g. generated MP4 with doorbell sound and anonymous snapshot)

Hi all – I have used this component successfully for awhile, but, have a nagging issue. I have everything feed into HomeKit to make it easy for my wife/family. I am able to stream doorbell/video (albeit slightly lagged).

I’ve created a custom binary sensor to only trigger an alert in HomeKit (using it as a “motion sensor” for my doorbell) that only turns on if there is a person detection to try and eliminate false positives. As follows:

  - platform: template
    sensors:
      person_doorbell:
        unique_id: fa1d8fc7-e7b6-4775-aa5b-1395a4817bea
        friendly_name: "Person Detection - Doorbell"
        device_class: motion
        delay_off: "00:05:00"
        value_template: "{{ is_state_attr('binary_sensor.motion_doorbell', 'event_object', 'person') }}"

However, what I’ve discovered is this sensor will remain in the on state for seemingly hours and will randomly turn off (unclear to me what triggers the off state).

To try and combat this, I’ve created an automation that will automatically turn off the sensor after a period of two minutes.

- id: '1630291931405'
  alias: Reset Person state for Doorbell
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.person_doorbell
    from: 'off'
    to: 'on'
    for: 00:02:00
  condition: []
  action:
  - condition: state
    entity_id: binary_sensor.person_doorbell
    state: 'off'
  mode: single

However, when the automation runs and I look at the trace info I get the following result, I’m at my wits end. Any assistant would be greatly appreciated!

Executed: August 29, 2021, 9:35:24 PM
Result:
result: false
entity_id/0

Executed: August 29, 2021, 9:35:24 PM
Result:
result: false
state: 'on'
wanted_state: 'off'

The reason that it does not turn off is that the value_template still returns true as the person attribute is not cleared after the event stops. Would it work if you combine with the state of the sensor?

Hi – first of all, thanks for the integration! Unfortunately I think I’ve reached my limits on knowledge here, I’m not sure I understand what you mean.

I believe @briis is suggesting that you use a combination state in your template sensor:

  - platform: template
    sensors:
      person_doorbell:
        unique_id: fa1d8fc7-e7b6-4775-aa5b-1395a4817bea
        friendly_name: "Person Detection - Doorbell"
        device_class: motion
        delay_off: "00:05:00"
        value_template: "{{ is_state('binary_motion_doorbell', 'on') and  is_state_attr('binary_sensor.motion_doorbell', 'event_object', 'person') }}"

which should resolve the root issue and make the automation unnecessary

3 Likes

@TazUk,

Works perfectly, thank you! Very helpful for anyone looking to reduce notifications and using HomeKit.

2 Likes

Hello there,

Anyone have played with the privacy service ?
I would like to add the call to the service to set and unset the full privacy settings using automation.

Thanks,

Hi @Zwordi
In your automation you can just use the below in the Actions to enable Privacy Mode for a Camera:

service: unifiprotect.set_privacy_mode
data:
  entity_id: camera.kamera_terrasse
  privacy_mode: true
  mic_level: 0
  recording_mode: never

And this to disable it again:

service: unifiprotect.set_privacy_mode
data:
  entity_id: camera.kamera_terrasse
  privacy_mode: false
  mic_level: 100
  recording_mode: smart

Please note that mic_level and recording_mode are optional. If you don’t set them, the will just be unchanged.

1 Like

Thank you so much.
Bringing camera at home is already a sensitive topic so it’s one big advantages of this series to be able to have a privacy mode.

1 Like
  • Would it be possible to control the presence detection using the smart detection only?
  • When trying to add the integration after installation i get “ABORTED”. Nothing mentioned in the log? Advice?

End of support for Non UnifiOS devices

After November 1st, 2021 new releases of this integration will no longer support devices that do not run UnifiOS. This will affect all users who have a CloudKey+ with firmware version 1.x
All user with a UDMP, UNVR or a CloudKey+ with firmware V2.x will not be affected by this change.

We estimate that the number of users still having demand for this, is so small that it is no longer worth the time and effort we have to put in to support it. If you are on a CloudKey+ with FW 1.x, please make sure to upgrade it to a V2.x before November 1st, to be able to continue to upgrade this Integration and get bug fixes and new features.

I’ve had this integration running great for about a year now, but lost a connection today and can’t seem to get it back. I’ve since tried reinstalling the integration and rebooting my Unifi hardware, but no luck.

I can still access my Unifi Protect services locally, but the integration doesn’t seem to like that IP. I keep getting “Error retrieving data from Unifi Protect.”

Any thoughts?

Check that the local user you have setup for accessing UniFi Protect is still active, and has admin rights. It need to look like the picture below. I have experienced cases where the local users somehow got disabled after a Protect upgrade.

You could also try to enable debug for the Integration and maybe also update to the latest Beta version 09.1-beta1, which improves error logging.

Yeah, verified my local user is setup correctly. I also tried to disable 2FA from my Unifi account, but no luck on that either. How do I get the beta version? I don’t see any beta releases in the HACS control panel.

@briis Thanks for your outstanding work !
Due to stream delay (aprox 18sec) i would like to use the camera snapshot to send a snapshot to my google home devices. Can someone help me out with this ? Kind of a beginner with these automations. I managed it to work with my mobile.

Thanks in advance