homebridge-unifi-protect-platform

1.1.0 • Public • Published

Latest Version Total Downloads License

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 Key Description Required
platform Homebridge Platform name.
This value should always be unifi-protect.
Y
name The name of this platform within Homebridge.
This is mainly used for logs and can be any value you want.
N
unifi Y
unifi.controller_url The URL to your controller. Y
unifi.username The 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 Key Description Required
unifi.auth_url The URL to auth.
By default, this resolves to: {unifi.controller}/api/auth/login
N
unifi.api_url The URL to the Protect API.
By default, this resolves to: {unifi.controller}/proxy/protect/api
N
unifi.ws_url The URL to the Protect WebSocket API.
By default, this resolves to: ws(s)://{controllerip}/proxy/protect/ws/updates
N
unifi.timeouts Override request timeouts N
unifi.timeouts.default Timeout in milliseconds for most requests
The default value is 30s.
N
unifi.timeouts.snapshot Timeout in milliseconds for snapshot requests
The 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.

Package Sidebar

Install

npm i homebridge-unifi-protect-platform

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

76.5 kB

Total Files

32

Last publish

Collaborators

  • shnhrrsn