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.

  • UniFi Protect running v2.6.17 or newer
  • Home Assistant Running v2022.12.0 or newer
  • A valid HTTPS certificate and properly configured external URL
    • If you are using Home Assistant Cloud, this is already set up for you.
    • If this is not setup correctly, the actionable notifications and attachments will not appear in the notifications.
    • You do not need your whole Home Assistant to be publicly accessible. Only the paths /api/unifiprotect/* and /api/webhook/* need to be accessible outside of your network.

Doorbell Ring Notifications

Requires a G4 Doorbell or G4 Doorbell Pro

Features

  • Receive notifications when someone rings your doorbell
  • Includes of a thumbnail from the camera at the moment it was rang

Optional features

  • Actionable notification to unlock the door / open a gate 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
  • Include a playback video leading up the doorbell ring. Note May significantly delay the receiving of the notification.

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

Images

In Home Assistant

In Action

Motion / Smart Detection Notifications

Features

Smart Detections requires a G4, AI or G5 Series camera.

  • Receive notifications when motion or a smart detection event is trigger by one of your UniFi Protect cameras
  • Includes a thumbnail of the event from UniFi Protect
  • If you are using iOS, you can instead stream the camera directly to your device
  • Will automatically update the notification with a video clip of the event after it completes.

Optional features

  • Filter for device tracker to “not be home” before triggering
  • Actionable notification to mute further notifications for a configurable amount of time

Motion / Smart Detection Notifications

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

License Plate Smart Detection Notifications

Requires UniFi Protect v2.7+ and an AI series camera capable of License Plate detection (AI Bullet, AI Theta, or AI DSLR). This the same as the Smart Detection Notification blueprint above, but it is explictly for detecting and displaying License Plates detected by an AI series camera.

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

Images

In Home Assistant

In Action

image

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.

22 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.

1 Like

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.