UniFi Protect - zones ids / names with events

Please add info about zones.

Now:
When person go into any zone, then there is entity which has status saying Person detected.

It it serious issue, because ALL zones trigger alarms. I can’t have zone outside gate, because it will constantly make false alarms. But such zone is needed, because UniFi need it to use smart search. Otherwise if something happen I need to manually watch 72 hours to catch the moment! This is ridiculous.

Without option to include / exclude zones for alarm there is no way to use full potential of the camera.

Better version:
Add info in which Zone the Person was detected.

Why?
Different zones should trigger different effects, but right now it is impossible. 1 camera can have range to cover a few zones. Person in zone X should trigger alert, but in zone Y turn on light etc.

We have 3 type of zones / lines:

  1. smart zones
  2. motion zones
  3. crossing lines

The best to add this feature to all of them, but you can start from smart zones.

How it should be done in entities?

  • For example camera.zone-id.person detected or not.
  • But NOT camera.person.zone-id, because Person 1 can be in zone X and Person 2 in zone Y which will make conflict for value and we will lose information about other zones.

Side info:
Not a long time ago UniFi added new API. I didn’t try. I don’t know if it is useful.
It is in protect/settings/control-plane/integrations in UniFi Protect.


The UniFi API was created to enable developers to monitor and manage UniFi deployments programmatically. It provides robust tools to access and control your UniFi devices’ data, allowing you to retrieve detailed information, monitor performance, and manage your infrastructure efficiently.
UniFi API Allows you to access application data from the local network. For high-level monitoring of multi-site deployments, please see our 
Site Manager API
.
Authentication
An API Key is a unique identifier used to authenticate API requests. These keys are crucial for ensuring secure access. Each key is tied to the UI account that created it, allowing for secure and personalized API interactions.
Obtaining an API Key
Open your Site in UniFi Site Manager at unifi.ui.com.
Click on Control Plane -> Admins & Users.
Select your Admin.
Click Create API Key.
Add a name for your API Key.
Copy the key and store it securely, as it will only be displayed once.
Click Done to ensure the key is hashed and securely stored.
Use the API Key.
Use the API Key
Incorporate the API key into the X-API-Key header. Follow the Example, replacing YOUR_API_KEY with your actual API key.
Example
curl -k -X GET 'https://IP/proxy/network/integrations/v1/sites' \
 -H 'X-API-KEY: YOUR_API_KEY' \
 -H 'Accept: application/json'

In URLs below there is full API documentation. You need to use IP of UniFi device:
https://IP/unifi-api/protect
https://IP/unifi-api/network

Not sure if there’s any official or HACS implementations of the new local API yet :eyes:

But in the meantime, you could use webhooks fired from Unifi Protect to HA :link:
Using the ‘alarms manager’ and webhooks, you can configure behaviour based on specific zones you’re drawn in Protect to trigger different webhooks (automations) :+1:

Guidance: GitHub - patfelst/Unifi-webhook-integration-with-Home-Assistant

1 Like

This is a great ask! I’m also wanting to know the zone for presence-like detection. The camera angle is too wide for it to be useful as a “person in any zone” report.

Do you know if missing zone id / name is because UniFi doesn’t share this information or because HA doesn’t process the information?

{…
‘to_state’: <state binary_sensor.camera_1_person_detected=on; event_id=685172ed0011bxxxxxxxxxxx, event_score=84, attribution=Powered by UniFi Protect Server, icon=mdi:walk, friendly_name=Camera 1 Person detected @ 2025-06-17T15:52:33.669981+02:00>, ‘for’: None, ‘attribute’: None, ‘description’: ‘state of binary_sensor.camera_1_person_detected’}

Can someone tell which method use HA to get events for Person detection? The best if can link to code core/homeassistant/components/unifiprotect at dev · home-assistant/core · GitHub which get this data.


Is it this one?

If UniFi doesn’t provide info about zone I would like to make feature request to UniFi.

@epenet hey sorry to ping you. Can you provide more info for this?