Control and monitor your Unifi Protect Cameras from Home Assistant
The unifiprotect
integration is now in Home Assistant core, so no more updates will be made to this repository. Please visit the official documentation for UniFi Protect to read more.
The unifiprotect
integration will be in Home Assistant core v2022.2. If you are running 0.10.x or older of the HACS integration, do not install v2022.2.x of Home Assistant core.
If you are running 0.11.x or the 0.12.0, you should be safe to delete the HACS version as part of your upgrade. The 0.11.x branch is designed to be compatible with the 0.12.0-beta and the HA core version. The latest version of 0.12.0-beta will be the version of unifiprotect
in HA core in v2022.0.
This repo is now deprecated in favor of the Home Assistant core version. This repo will be archived and removed from HACS after the 2022.4 release of Home Assistant.
We have disable reporting issues to the HACS Github repo for the unifiprotect
integration. If you have an issue you would like to report for the unifiprotect
integration, please make you are running the HA core version of the integration provided by 2022.2.0 or new and then report your issue on the HA core repo.
If you would still like to discuss the HACS version of the unifiprotect
integration, feel free to use the dicussions section or the HA Community forums thread.
If you have Smart Sensor devices and you are not running 0.12.0-beta10
or newer, it is recommended you just delete your UniFi Protect integration config and re-add it. If you do not have Smart Sensor devices, you can migrate to the Home Assistant core version by following the steps below:
unifiprotect
integration from HACS (do not remove your unifiprotect
config entry). It is safe to ignore the warning about needing to remove your config first.You must remove the HACS integration efore upgrading to 2022.2.0 first to prevent a conflicting version of pyunifiprotect
from being installed.
0.10.x
or older still exists; this code has been removed in the HA core versionFull language support. All of the languages HA core supports via Lokalise has been added to the ingration.
Auto-discovery. If you have a Dream machine or a Cloud Key/UNVR on the same VLAN, the UniFi Protect integration will automatically be discovered and prompted for setup.
UP Doorlock support. The HA core version has full support for the newly release EA UP Doorlock.
The UniFi Protect Integration adds support for retrieving Camera feeds and Sensor data from a UniFi Protect installation on either an Ubiquiti CloudKey+, Ubiquiti UniFi Dream Machine Pro or UniFi Protect Network Video Recorder.
There is support for the following device types within Home Assistant:
It supports both regular Ubiquiti Cameras and the UniFi Doorbell. Camera feeds, Motion Sensors, Doorbell Sensors, Motion Setting Sensors and Switches will be created automatically for each Camera found, once the Integration has been configured.
In general, stable/beta version of this integration mirror stable/beta versions of UniFi Protect. That means:
Stable versions of this integration require the latest stable version of UniFi Protect to run.
Beta versions / master
branch of this integration require the latest beta version of UniFi Protect to run (or the latest stable if there is no beta)
We try our best to avoid breaking changes so you may need to use older versions of UniFi Protect with newer versions of the integration. Just keep in mind, we may not be able to support you if you do.
If you are not using the latest beta of the integration, you can view old versions of this README at any time in GitHub at https://github.com/briis/unifiprotect/tree/{VERSION}
. Example, docs for v0.9.1 can be found at https://github.com/briis/unifiprotect/tree/v0.9.1
As of v0.10 of the integration, the following versions of HA and UniFi Protect are required to even install the integration:
This Integration supports all UniFiOS Consoles that can run UniFi Protect. Currently this includes:
Ubiquity released V2.0.24 as an official firmware release for the CloudKey+, and it is recommended that people upgrade to this UniFiOS based firmware for their CloudKey+, as this gives a much better realtime experience.
CKGP with Firmware V1.x do NOT run UniFiOS, you must upgrade to firmware v2.0.24 or newer.
NOTE: If you are still running a version of UniFi Protect without a UniFiOS Console, you can use a V0.8.x as it is the last version fully supported by NON UniFiOS devices. However, please note NON UniFiOS devices are not supported by us anymore.
Before you install this Integration you need to ensure that the following two settings are applied in UniFi Protect:
Local User
HINT: A few users have reported that they had to restart their UDMP device after creating the local user for it to work. So if you get some kind of Error 500 when setting up the Integration, try restart the UDMP.
RTSP Stream
The Integration uses the RTSP Stream as the Live Feed source, so this needs to be enabled on each camera. With the latest versions of UniFi Protect, the stream is enabled per default, but it is recommended to just check that this is done. To check and enable the the feature
This Integration is part of the default HACS store. Search for unifi protect under Integrations and install from there. After the installation of the files you must restart Home Assistant, or else you will not be able to add UniFi Protect from the Integration Page.
If you are not familiar with HACS, or haven't installed it, I would recommend to look through the HACS documentation, before continuing. Even though you can install the Integration manually, I would recommend using HACS, as you would always be reminded when a new release is published.
Please note: All HACS does, is copying the needed files to Home Assistant, and placing them in the right directory. To get the Integration to work, you now need to go through the steps in the Configuration section.
Before you restart Home Assistant, make sure that the stream component is enabled. Open configuration.yaml
and look for stream:. If not found add stream:
somewhere in the file and save it.
To add UniFi Protect to your Home Assistant installation, go to the Integrations page inside the configuration panel, click on + ADD INTEGRATION
, find UniFi Protect, and add your UniFi Protect server by providing the Host IP, Port Number, Username and Password.
Note: If you can't find the UniFi Protect integration, hard refresh your browser, when you are on the Integrations page.
If the UniFi Protect Server is found on the network it will be added to your installation. After that, you can add more UniFi Protect Servers, should you have more than one installed.
You can only add UniFi Protect through the Integration page, Yaml configuration is no longer supported.
When you upgrade your CloudKey+ from FW V1.x to 2.x, your CK wil move to UniFiOS as core operating system. That also means that where you previously used port 7443 you now need to use port 443. There are two ways to fix this:
.storage/core.config_entries
in your Home Assistant instance. Search for UniFi Protect and change port 7443 to 443. Restart Home Assistant. (Make a backup first)host:
(string)(Required)
Type the IP address of your UniFi Protect NVR. Example: 192.168.1.1
port:
(int)(Optional)
The port used to communicate with the NVR. Default is 443.
username:
(string)(Required)
The local username you setup under the Prerequisites section.
password:
(string)(Required)
The local password you setup under the Prerequisites section.
verify ssl:
(bool)(Required)
If your UniFi Protect instance has a value HTTPS cert, you can enforce validation of the cert
deactivate rtsp stream
(bool)Optional
If this box is checked, the camera stream will not use the RTSP stream, but instead jpeg push. This gives a realtime stream, but does not include Audio.
realtime metrics
(bool)Optional
Enable processing of all Websocket events from UniFi Protect. This enables realtime updates for many sensors that are disabled by default. If this is disabled, those sensors will only update once every 15 minutes. Will greatly increase CPU usage, do not enable unless you plan to use it.
override connection host
(bool)Optional
By default uses the connection host provided by your UniFi Protect instance for connecting to cameras for RTSP(S) streams. If you would like to force the integration to use the same IP address you provided above, set this to true.
The Integration adds specific UniFi Protect services and supports the standard camera services. Below is a list of the UniFi Protect specific services:
Service | Parameters | Description |
---|---|---|
unifiprotect.add_doorbell_text |
device_id - A device for your current UniFi Protect instance (in case you have multiple).message - custom message text to add |
Adds a new custom message for Doorbells.* |
unifiprotect.remove_doorbell_text |
device_id - A device for your current UniFi Protect instance (in case you have multiple).message - custom message text to remove |
Remove an existing custom message for Doorbells.* |
unifiprotect.set_default_doorbell_text |
device_id - A device for your current UniFi Protect instance (in case you have multiple).message - default text for doorbell |
Sets the "default" text for when a message is reset or none is set.* |
unifiprotect.set_doorbell_message |
device_id - A device for your current UniFi Protect instance (in case you have multiple).message - text for doorbell |
Dynamically sets text for doorbell.** |
unifiprotect.profile_ws_messages |
device_id - A device for your current UniFi Protect instance (in case you have multiple).duration - how long to provide |
Debug service to help profile the processing of Websocket messages from UniFi Protect. |
*: Adding, removing or changing a doorbell text option requires you to restart your Home Assistant instance to be able to use the new ones. This is a limitation of how downstream entities and integrations subscribe to options for select entities. They cannot be dynamic.
**: The unifiprotect.set_doorbell_message
service should only be used for setting the text of your doorbell dynamically. i.e. if you want to set the current time or outdoor temp on it. If you want to set a static message, use the select entity already provided. See the Dynamic Doorbell blueprint for an example.
As part of the integration, we provide a couple of blueprints that you can use or extend to automate stuff.
If logs are needed for debugging or reporting an issue, use the following configuration.yaml:
logger:
default: error
logs:
pyunifiprotect: debug
custom_components.unifiprotect: debug
Fork and clone the repository.
Open in VSCode and choose to open in devcontainer. Must have VSCode devcontainer prerequisites.
Run the command container start from VSCode terminal
A fresh Home Assistant test instance will install and will eventually be running on port 9123 with this integration running
When the container is running, go to http://localhost:9123 and the add UniFi Protect from the Integration Page.