1.1.0 • Published 4 years ago

homebridge-unifi-protect-platform v1.1.0

Weekly downloads
11
License
MIT
Repository
-
Last release
4 years ago

homebridge-unifi-protect-platform

UniFi Protect platform for Homebridge with support for realtime events from UniFi Cameras and Doorbells.

NOTE: This only works with UniFi OS capable devices (UDM-Pro); it has been not been tested with the vanilla UCK-G2.

Installation

  1. Homebridge
  2. npm i -g homebridge-unifi-protect-platform
  3. Add platform to your config file

Supported Features

Unlike other UniFi Homebridge platforms, this platform provides realtime events and does not poll at set intervals. This means you’ll get doorbell and motion events pushed to HomeKit instantaneously.

  • Camera
  • Doorbell Events (Push)
  • Motion Event (Push)

Tested Devices

  • UDM-Pro
  • UVC-G3
  • UVC-G3-Dome
  • UVC-G4-Doorbell

Configuration

In order to use this plugin, you’ll need to add the following JSON object to your Homebridge config file:

{
  "platform": "unifi-protect",
  "name": "unifi-protect",
  "unifi": {
    "controller_url": "https://controller-ip:controller-port",
    "username": "homekit",
    "password": "homekit"
  }
}
Config KeyDescriptionRequired
platformHomebridge Platform name.This value should always be unifi-protect.Y
nameThe name of this platform within Homebridge.This is mainly used for logs and can be any value you want.N
unifiY
unifi.controller_urlThe URL to your controller.Y
unifi.usernameThe username to login to your controller.Y

Advanced Config

The values above are the basics to get you started, however you can fine tune your config if needed:

Config KeyDescriptionRequired
unifi.auth_urlThe URL to auth.By default, this resolves to: {unifi.controller}/api/auth/loginN
unifi.api_urlThe URL to the Protect API.By default, this resolves to: {unifi.controller}/proxy/protect/apiN
unifi.ws_urlThe URL to the Protect WebSocket API.By default, this resolves to: ws(s)://{controllerip}/proxy/protect/ws/updatesN
unifi.timeoutsOverride request timeoutsN
unifi.timeouts.defaultTimeout in milliseconds for most requestsThe default value is 30s.N
unifi.timeouts.snapshotTimeout in milliseconds for snapshot requestsThe default value is 15s.N

To Do

Development

Environment

All development tooling dynamically configures Homebridge through environment vars that should be set to match your environment. These values can be found in the dev/start.ts file.

A .env file is supported in the root of the project directory.

Tools

homebridge-unifi-protect-platform has some tooling to help making development easier:

  • yarn dev will launch Homebridge through TypeScript pointed towards src
  • yarn dev:stream displays all events emitted from the controller
  • yarn dev:inspect displays an output of your current Protect enviroment

Credits

Much of the initial charactistic/services code has been lifted and repurposed from dgreif/ring. Huge thanks to @dgreif!

License

homebridge-unifi-protect-platform was created by Shaun Harrison and is made available under the MIT license.