Unifi Protect is Ubiquiti Networks next generation Camera NVR.
The previous iteration, Unifi NVR, home assistant integration. I believe that some of that can be re-used to create a new native Unifi Protect component. Unfortunately Unifi Protect does not have an API yet, nor does it look like one will be made available anytime soon.
I’ve done some preliminary research and come across a few things.
The Camera itself seems to operate in the same manor that it did on Unifi NVR. So I believe the primary piece to re-work is how the component authenticates and pulls a list of cameras from the Protect NVR. Once that portion is complete I think that the camera portions can be used. The way the current component works for Unifi NVR is it pulls a list of cameras, connects, then does everything directly with the camera itself (my current understanding). You can check this by shutting down the Unifi NVR and the cameras are still integrated within HA and providing video streams (until restart).
Unifi Protect Notes:
Get Camera Password:
root@ck-plus:~# psql -U unifi-protect
psql (9.6.10)
Type "help" for help.
unifi-protect=> SELECT "devicePassword" FROM nvrs;
devicePassword
Undocumented API:
Get basic information about the system (e.g. firmware version):
GET /api/ump/info
To authenticate, send username and password (json encoded) to
POST /api/auth
You will get a JWT Bearer style authentication header back, that you need to include in later requests (in addition to a number of other items about the user.
Next you need to request an access key. this key is required to get images later:
POST /api/auth/access-key
(no data, just the Authorization header from above)
Get a list of events:
GET /api/events?end=[unix timestamp]&start=[unix timestamp] &type=motion
Example:
[{"type":"motion","start":1547086305207,"end":1547086314307,"camera":"5c30d50f03008f03e7000799","score":39,"thumbnail":"5c36a9e803611d03e700046c","heatmap":"5c36a9e9006a1d03e700046d","id":"5c36a9e3010c1d03e7000469"}....]
Retrieve a thumbnail image for the event use the “thumbnail” parameter and request:
GET /api/thumbnails/[hex thumbnail id]?accessKey=[key returned from 'access-key' request above]
Reboot a camera:
POST /api/camera/[hex cameraid]/reboot