UniFi Protect Blueprints

Below are some officially maintained blueprints for the UniFi Protect integration.

Requirements

To take full effect of this automation blueprint, your Home Assistant instance needs some setup beforehand.

  • A UniFi Protect NVR running on a UDM Pro, UNVR or other Protect Console
  • Home Assistant 2022.2.0 or newer running the UniFi Protect integration
  • A UniFi camera pair with your NVR
    • (Smart/Motion Blueprint only): If you want to filter smart detections, you need a Smart Detection capable camera. This is any G4 series camera except the EA G4 Instant.
    • (Doorbell Blueprint only): Your camera must have a chime (like the G4 Doorbell)
  • (Smart/Motion/Doorbell Blueprints): A valid HTTPS certificate and public facing Home Assistant instance
    • If you do not have these, the actionable notifications and images will not appear in the notifications.
    • You do not need your whole Home Assistant to be publically accessible. Only the paths /api/camera_proxy/* and /api/webhook/* need to be accessible outside of your network.
  • (Optional, Doorbell Blueprint only): A lock entity for your door to allow you to unlock the door via notification
  • (Smart/Motion Blueprint only, if you want HTML5 Push): HTML5 Push notification Configured
  • (Smart/Motion Blueprint only, if you want Mobile app): HA Companion app install on iOS or Android
  • (Smart/Motion Blueprint only, if you want Telegram): The Telegram integration configured

Doorbell Notifications

Receive notifications when someone rings your doorbell. Optional features:

  • Actionable notification to unlock the door and play a TTS message
  • Actionable notification to respond to the person at the door
  • Actionable notification to mute further notifications for a configurable amount of time

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Images

In Home Assistant

In Action

image

Motion / Smart Detection Notifications

Two blueprints here. Split out for performance (it is unlikely you will want both on the same notification target anyways!)

Receive notifications when motion or a smart detection event is trigger by one of your UniFi Protect cameras. Optional features:

  • Filter for device tracker to “not be home” before triggering
  • Filter for detected object (for smart detections)
  • Actionable notification to mute further notifications for a configurable amount of time

Motion Notifications

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Smart Detection Notifications

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Images

In Home Assistant

In Action

image

Dynamic Doorbell

Allows you to set your Doorbell text on your G4 Doorbell dynamically. Some examples include adding the current time and/or outside temp to your doorbell

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Images

In Home Assistant

Source Code / Contributing

You can find the source for the blueprints on Github.

Huge thanks to @hunterjm who I got a lot of great inspiration from to really improve the blueprints a lot for his blueprints for Frigate. My blueprints were oringanly a mess and required like 6 different blueprints and I was able to get them all down to just 2 after looking at his.

8 Likes

Looking good! Glad to hear you were able to get some inspiration from my blueprint. I would recommend adding the optional presence filter to your notifications however. I didn’t have that in my blueprint initially and especially for people with interior cameras, the notifications become very noisy even with cooldown when you are home and walking around inside.

I will have to look at how your presence filter works then. I assumed that was something to do with Frigate. I did the Smart Detection filter, which I thought was the equivalent, but it does make sense if you are using actually occupancy entities instead.

It’s just an optional filter for device tracker entities or groups checking if they are “home” or not before sending the notification.

Updated the description of the post. The blueprints should be “stable” now. Changes made:

  • Removed the fancy target selector and split motion/smart into two blueprints (it was causing huge CPU increases to keep them).
  • Added the recommended precense filter from @hunterjm

Updated description to make it easier to navigate (images hidden in collapse section). Also, new changes for blueprints:

  • Fixes some bugs (channel/tag name being generated wrong, triggering on unavailable).
  • Adds TTS actions to Doorbell Notification
  • Adds Telegram notification targets (thanks @mjdyson)
  • Adds Dynamic Doorbell blueprint

Thanks for the blueprint! It looks like the timestamp on iOS notifications is 4 hours ahead? Any thoughts on how to set the correct time/offset?

It uses the timezone you set on your Home Assistant instance. So if it is coming through wrong, you probably have the wrong timezone selected globally.

Just checked it and it correct. The logs reflect the correct time and offset. Any ideas on where else to check?

Not sure what was causing this but the timestamps are now correct without any changes. Thanks for the great work!

Regarding the Doorbell notification for Companion App (Android), is there anything special to be done to get the camera image directly in the notification like in the screenshots?

I only get the text (without image)

Read the requirements in the blueprint. You have to configure a base image URL (should be your external URL or Nabu Casu URL). It must have a valid HTTPS cert and must be publicaly accessible from outside of your network. Blueprint gives details on specific paths.

This is a hard requirement since Apple/Google actually fetch the URLs for the images before sending them to your phone. Your phone does not hit the URLs directly.

Thank you for a fast reply.
I found the error. I had an / at the end in my image base url:
E.g : https://HASS-URL/

Has anyone figured out how to get the URL redirect for tapping on a notification to open the UniFi Protect app AND navigate to that specific camera?

If there wasn’t a streaming delay for the camera feeds via HA, I’d stick with viewing through the HA app directly, but since the true live feed is available via the native app, I’d like to tap on it and have it open the UniFi protect app. Is this possible?

There is no uniform way of opening another app in Android and iOS. So no, it is not possible with the blueprint.

If there wasn’t a streaming delay for the camera feeds via HA

Are you using LL-HLS?

1 Like

Updated for the HA Core release. Moved blueprints to their own repo since the HACS repo will be archived in the future.

Any links to the HA docs for the UniFi Protect integration will 404 until the stable release of 2022.2.0. Beta docs can be found at: UniFi Protect - Home Assistant

No changes to the blueprints themselves except adding a source_url, updating references to docs and using the unifiprotect__lcd_message device class for the Dynamic Doorbell Text Selector.

I wasn’t, but just enabled LL-HLS.

I’m now seeing about a 2 second delay when preload stream is selected, and 4-5 seconds when preload stream is not selected.

Does this sound right?

@AngellusMortis would it be possible to modify the Blueprint for the smart detections to be based on presence and time? (I’ve been tryign to ask for this repeatedly on the Unifi Forums, but the employees don’t listen, and it used to work before the protect redesign)

i.e.
I am home, but don’t want alerts 6am - 11pm but want alerts from 11pm to 6am.
I am away, I want all alerts.

Thanks for the awesome work on the Blueprints.

I do not have the bandwidth for it at the moment.

Contributions are welcome: https://github.com/AngellusMortis/unifiprotect_blueprints

Hello again, I am confused on the setup for the Smart Detection blueprint. I have a G4 Doorbell, G4 Pro and a G4 Bullet (all with the official integration) so I should have smart detections. But when I try to use the blueprint, i get “No matching entities found” in the “Smart Dection Entity” section.