I just recently migrated from Unifi Video NVR to Unifi Protect NVR. I run Unifi Protect on a Unifi Cloud Key Gen2+ and I must say I really love the system. It is all local, so no cloud dependency and no sharing of my recordings with external parties.
Even though I can get the Camera feed in to Home Assistant using the Generic Camera component, and also some other stuff by installing MQTT on the Cloud Key, I would rather just have a Component that does all that, and without having to fiddle around outside Unifi Protect and Home Assistant.
So I decided to see if I could write my own Custom Component supporting the Unfi Protect platform. The problem I ran into immediately was that there is no official API released by Ubiquiti, but by searching the web I found a couple of people who had found some API commands that worked. So with this as a starting point and using Google Inspector I managed to pull enough together to write this and get support for what I wanted.
The component is supporting the following:
- camera - It will automatically add a Camera entity of all Cameras found in your Unifi Protect NVR, and this supports all the basic Camera functions in HA.
- binary_sensor - For each camera in Unifi Protect a binary sensor is created that shows if motion occurs on that camera. Note: This only works if the camera is armed.
- sensor - Again, for all cameras a sensor is created that shows the current Recording State
Installation and Configuration
Please go to the Github Repository for installation and configuration instructions.
I am a “learn as you go” programmer, so please excuse me if the code is not optimal Python, but I have now had it running for a few days on 2 different HA installations and without receiving any errors, so it seems to me that it works as expected.
So I really look forward to hear from other people testing this.