This package has been deprecated

Author message:

WARNING: This project has been renamed to homebridge-unifi-protect. Uninstall this package and install homebridge-unifi-protect using the following command line: npm -g --unsafe-perm install homebridge-unifi-protect

homebridge-unifi-protect2

3.6.3 • Public • Published

homebridge-unifi-protect: Native HomeKit support for UniFi Protect

Homebridge UniFi Protect

Downloads Version verified-by-homebridge

HomeKit support for the UniFi Protect ecosystem using Homebridge.

homebridge-unifi-protect is a Homebridge plugin that provides HomeKit support to the UniFi Protect device ecosystem. UniFi Protect is Ubiquiti's next-generation video security platform, with rich camera, doorbell, and NVR controller hardware options for you to choose from, as well as an app which you can use to view, configure and manage your video camera and doorbells.

Why use this plugin for UniFi Protect support in HomeKit?

This plugin attempts to bridge a gap in the UniFi Protect ecosystem by providing native HomeKit support on par with what you would expect from a first-party of native HomeKit solution. Our north star is to create a plugin that just works with minimal required configuration by you, the end user, to get up and running. The goal is to provide as close to a streamlined experience as you would expect from a first-party or native HomeKit solution. For the adventurous, there are more granular options available to enable you to further tailor your experience.

What does just works mean in practice? It means that this plugin will discover all your supported UniFi Protect devices and make them available in HomeKit. It supports all known UniFi Protect controller configurations (UniFi CloudKey Gen2+, UniFi Dream Machine Pro, and UniFi Protect NVR).

For the more technically inclined - this plugin has continued to pioneer the HomeKit user experience for UniFi Protect by being the first Homebridge plugin to successfully reverse engineer the UniFi Protect realtime events API that was introduced with UniFi OS. This means that rather than poll the controller every few seconds to catch events, we're able to capture motion and doorbell ring events in realtime, providing an extremely responsive HomeKit experience, and reducing the performance impact to Protect controllers.

Features

  • Easy configuration - all you need is your UniFi Protect controller IP address, username, and password to get started. The defaults work for the vast majority of users. When you want more, there are advanced options you can play with, if you choose.

  • Blazing fast video streaming. Video streaming from HomeKit will start within in 1-2 seconds for G3-series cameras and 3-4 seconds for G4-series cameras, in most cases. I've spent the time to optimize the video streaming experience to ensure it feels very responsive, and just works.

  • Full UniFi Protect G4 Doorbell support.. This plugin provides complete support for UniFi Protect G4 Doorbells. We support all the features of the doorbell including - doorbell rings, two-way audio, and the use of the onboard LCD screen for messages. Two-way audio has caveats you should be aware of.

  • Two-way audio support for all UniFi Protect cameras that support it. In addition to UniFi Protect G4 Doorbells, the UniFi Protect G3 Micro provides two-way audio capabilities, and that functionality is available to you in HomeKit.

  • Support for multiple controllers. This plugin can support multiple UniFi Protect controllers. If you have more than one controller, it's easy to add them to this plugin, and integrate them seamlessly into HomeKit.

  • Automatic continuous detection and configuration of all UniFi Protect devices. By default - all of your supported UniFi Protect devices are made available in HomeKit without needing any further configuration on your part. Additionally, if you add or remove cameras or other devices to your UniFi Protect controller, this plugin will autodetect those configuration changes and add or remove those devices in HomeKit, seamlessly, in realtime.

  • The ability to selectively hide and show specific Protect devices. For those who only want to show particular devices in HomeKit, or particular controllers, a flexible and intuitive way to configure device availability at a granular level is available.

  • Motion detection support using a native realtime notification API (UniFi OS). On UniFI OS-based controllers, we use a native realtime notification API, without having to continuously poll the UniFI Protect controller. This does a couple of things - first, it provides true realtime HomeKit rich notifications when motion is detected, including image snapshots. Second, this approach eliminates the requirement to continuously poll every few seconds that most non-native solutions to motion detection on UniFi Protect have used until now and reduces the load on UniFi Protect controllers substantially.

  • Motion detection support for UniFi CloudKey Gen2+ controllers. For those using UCK Gen2+ controllers, support for motion detection with rich notifications is also available, although only using poll-based notifications. Unfortunately, Ubiquiti hasn't yet implemented a realtime notification API for UCK Gen2+ controllers, but should Ubiquiti implement it in the future, this plugin will provide support for it.

  • Motion sensor control from within HomeKit. By default, all detected cameras have two additional services attached to them - a motion sensor service, and a motion switch service. The motion switch allows you to selectively activate and deactivate motion detection of your cameras. This is especially useful in automation scenarios where you wish to activate or deactivate motion detection selectively when you leave your home or arrive home, for example.

  • Create scenes or presets for groups of cameras. If you choose to create specific liveviews, a security system accessory will appear in HomeKit, enabling you to have motion-detection scenes or presets a tap away. For even more customization, you can create liveview-based switches that will allow you to enable or disable motion detection on groups of cameras. They're easy and intuitive to create and can amplify your user experience in HomeKit.

  • MQTT support. MQTT support is available for those that want to make UniFi Protect accessible to an MQTT broker.

What's not in this plugin right now

Acoustic Echo Cancellation (AEC) support for two-way audio in UniFi Protect. We're most of the way there with two-way audio support, and hopefully AEC support can be reverse-engineered in the future.

Currently, we support doorbell ring events, motion sensor, incoming video, and two-way audio.

I hope to continue to work on this one to get AEC working for two-way audio. You can also read more on about two-way audio support here.

Documentation

  • Getting going
  • Advanced Topics
    • Autoconfiguration: what it is, design choices that I've made, and why.
    • Feature Options: granular options to allow you to set the camera quality individually, show or hide specific cameras, controllers, and more.
    • Doorbells: how UniFi Protect doorbell support works in this plugin, and how to use all the available features including doorbell messages.
    • Liveview Scenes: use the UniFi Protect liveviews feature (available in the UniFi Protect controller webUI) to create motion-detection scenes.
    • MQTT: how to configure MQTT support.
    • Advanced Configuration: complete list of configuration options available in this plugin.
    • Realtime API Documentation: documentation of how the Ubiquiti realtime updates API works and how to decode the binary protocol.
    • Changelog: changes and release history of this plugin, starting with v3.0.

Installation

If you are new to Homebridge, please first read the Homebridge documentation and installation instructions before proceeding.

If you have installed the Homebridge Config UI, you can intall this plugin by going to the Plugins tab and searching for homebridge-unifi-protect and installing it.

If you prefer to install homebridge-unifi-protect from the command line, you can do so by executing:

sudo npm install --unsafe-perm -g homebridge-unifi-protect

You will need a working ffmpeg installation for homebridge-unifi-protect to work correctly. To make installation more convenient, this plugin uses ffmpeg-for-homebridge which provides prebuilt versions of ffmpeg for some of the more popular platforms. Click here for a list of platforms supported by ffmpeg-for-homebridge. If you don't find your platform listed, you'll need to install a working version of ffmpeg for yourself, if you want video streaming to work. Setting up and configuring ffmpeg is beyond the scope of this documentation.

Audio

Audio on cameras is tricky in the HomeKit world to begin with, and when you throw in some of the specifics of how UniFi Protect works, it gets even more interesting. Some things to keep in mind if you want to use audio with UniFi Protect:

  • This plugin provides audio on UniFi cameras and doorbells. This includes two-way audio on the G4 Doorbell and G3 Micro.

  • There is one notable caveat, currently, with two-way audio: the lack of acoustic echo cancellation, or AEC. Read more on about two-way audio here.

  • Audio support will not work unless you have a version of ffmpeg that supports fdk-aac. Unfortunately, most default installations of ffmpeg are not compiled with support for fdk-aac. You'll need to compile or acquire a version of ffmpeg that does. Doing so is beyond the scope of this documentation. There are plenty of guides to this - Google is your friend. This plugin uses ffmpeg-for-homebridge which eases the pain somewhat by providing prebuilt static binaries of ffmpeg for certain platforms, and save you the trouble of having to compile a version of ffmpeg yourself.

Using another video processor

videoProcessor is the video processor used to stream video. By default, this is ffmpeg, but can be your own custom version of ffmpeg or other video processor that accepts and understands ffmpeg command line arguments.

{
  "platform": "UniFi Protect",
  "videoProcessor": "/my/own/compiled/ffmpeg",
  "controllers": [
    ...
  ]
}

Things to be aware of

  • Beginning with v3.6.0, this plugin requires Homebridge v1.1.3 on greater to work. For some, this may be a breaking change if you are running on older versions of Homebridge.

Plugin configuration

If you choose to configure this plugin directly instead of using the Homebridge Configuration web UI, you'll need to add the platform to your config.json in your home directory inside .homebridge.

"platforms": [
  {
    "platform": "UniFi Protect",
 
    "controllers": [
      {
        "address": "1.2.3.4",
        "username": "some-unifi-protect-user (or create a new one just for homebridge)",
        "password": "some-password"
      }
    ]
  }
]

For most people, I recommend using Homebridge Configuration web UI to configure this plugin rather than doing so directly. It's easier to use for most users, especially newer users, and less prone to typos, leading to other problems.

For UniFi OS devices like UDM-Pro, UniFi NVR, you can use your Ubiquiti account credentials, though 2FA is not currently supported. That said, I strongly recommend creating a local user just for Homebridge instead of using this option.

Package Sidebar

Install

npm i homebridge-unifi-protect2

Weekly Downloads

6

Version

3.6.3

License

ISC

Unpacked Size

422 kB

Total Files

45

Last publish

Collaborators

  • hjdhjd