Custom Component: Unifi Protect

Most likely a caching issue in your browser. See this post Not listed in Add Integrations? · Discussion #262 · briis/unifiprotect · GitHub

@briis you were totally right! Thanks! I tried a different browser and it worked.

1 Like

Hi all,

New to HA and Unifi. I have Unifi Protect integrated in HA via HACS with 3 G4 Pros and 1 G4 Doorbell. Everything is working, but I can not figure out how to make it so when a person (or motion) is detected it notifies me (iPhone) of the notification and includes a picture of what is happening.

How do I make that happen? Configuration > Automatons > New Automation > Switch to Yaml mode? Then what?

Here is what I have now:

alias: Front Yard Motion
description: ''
trigger:
  - type: motion
    platform: device
    device_id: 9ed32acb09386bffff99f0fe4ef8d158
    entity_id: binary_sensor.motion_front_yard
    domain: binary_sensor
condition: []
action:
  - service: notify.mobile_app_mr_walters
    data:
      message: There is motion in the front yard
mode: single

Thanks!

Just a general heads-up for anyone using the save_thumbnail service with any Unifi cameras that don’t support object detection.

With the release of Protect v1.19.0 - release notes here they have adopted square thumbnails.

In my experience this effectively renders the image_width parameter of the service irrelevant, and testing on my G3-Flex basically produces an image that does not reflect a clear view of the motion event. With our garage camera I tested by entering the garage and received a small square image of one wing of one of our cars. The thumbnail gave no visual indication that a person was in the garage.

I’ve experimented with using the camera.snapshot service however for motion events I’d have to factor in a nearly 20 second delay on the stream, making it unusable. Note that I understand why this issue occurs and that it is outside the purview of the component. As we want audio on the stream the alternatives are not particularly viable for our setup.

With that in mind I’ve expanded my use of Deepstack to scan for and identify objects based on the motion triggers provided by the component, and limited snapshots to physical events (e.g. the garage door closing, the doorbell being pushed, etc.)

Just wanted to give any other users of the save_thumbnail service a heads up - YMMV of course.

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.