1.1.0 • Published 4 years ago

homebridge-ufp v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

homebridge-ufp

Unifi Protect plarform plugin for Homebridge

This plugin is intended to automatically configure all the cameras you have setup in UniFi Protect to make them available via HomeKit. It requires the camera-ffmpeg plugin in order to provide that functionality.

This package is based on the excellent work of homebridge-camera-unifi.

Why use this homebridge plugin?

This plugin aims to be a one-stop-shop for UniFi Protect to HomeKit connectivity. Over time, it is my hope to add motion sensors and any other capabilities that make sense to this plugin to enable HomeKit users to easily connect the UniFi Protect and HomeKit worlds.

Installation

If you are new to Homebridge, please first read the Homebridge documentation. If you are running on a Raspberry, you will find a tutorial in the homebridge-punt Wiki.

Install homebridge:

sudo npm install -g homebridge

Install homebridge-ufp:

sudo npm install -g homebridge-ufp

You will need a working ffmpeg installation for this plugin to work. Configuring ffmpeg is beyond the scope of this manual. Please refer to the excellent documentation for camera-ffmpeg.

Finally, adding cameras requires the same steps outlined in camera-ffmpeg. Install the accessories and use the Homebridge setup code for the camera accessories.

Configuration

Add the platform in config.json in your home directory inside .homebridge.

If you're using a UniFi Protect device that is not running UniFi OS (UDM-Pro < 1.6, UniFi NVR-4 < 1.3.0, or CloudKey Gen2+), you can use the following config (note the port 7443).

"platforms": [
  {
    "platform": "Camera-UniFi-Protect",
    "name": "UniFi Protect",

    "controllers": [
      {
        "url": "https://my-ufp-device:7443",
        "username": "some-homebridge-user (or create a new one just for homebridge)",
        "password": "some-password"
      }
    ]
  }
]

If you're using a device running UniFi OS (UDM-Pro ≥ 1.6.0, UniFi NVR-4 ≥ 1.3.0), drop the port and use your regular Ubiquiti Account credentials. This does not currently support 2FA. You may also be able to create a read-only account, but this has not been tested.

"platforms": [
  {
    "platform": "Camera-UniFi-Protect",
    "name": "UniFi Protect",

    "controllers": [
      {
        "url": "https://my-ufp-device",
        "username": "your-ubiquiti-account",
        "password": "your-ubiquiti-password"
      }
    ]
  }
]

Advanced Configuration (Optional)

This step is not required. For those that prefer to tailor the defaults to their liking, here are the supported parameters.

"platforms": [
  {
    "platform": "Camera-UniFi-Protect",
    "name": "UniFi Protect",
    "videoProcessor" : "/usr/local/bin/ffmpeg",

    "controllers": [
      {
        "url": "https://my-ufp-device",
        "username": "some-homebridge-user (or create a new one just for homebridge)",
        "password": "some-password"
      }
    ],

    "videoConfig": {
        "sourcePrefix": "-re -rtsp_transport http",
        "additionalCommandline": "-preset slow -profile:v high -level 4.2 -x264-params intra-refresh=1:bframes=0",
        "mapaudio": "0:0",
        "mapvideo": "0:1",
        "maxStreams": 4,
        "maxWidth": 1920,
        "maxHeight": 1080,
        "maxFPS": 20
    } 
  }
]
FieldsDescriptionDefaultRequired
platformMust always be Camera-UniFi-Protect.Yes
nameFor logging purposes.No
videoProcessorSpecify path of ffmpeg or avconv"ffmpeg"No
urlURL for your UniFi Protect NVRYes
usernameYour UniFi Protect usernameYes
passwordYour UniFi Protect passwordYes
sourcePrefixPrefix to apply to ffmpeg source command."-re -rtsp_transport http"No
additionalCommandlineAdditional parameters to pass ffmpeg to render video."-preset slow -profile:v high -level 4.2 -x264-params intra-refresh=1:bframes=0"No
mapaudioMapping of audio channels for ffmpeg."0:0"No
mapvideoMapping of video channels for ffmpeg."0:1"No
maxStreamsMaximum number of streams allowed for a camera.4No
maxWidthMaximum width of a video stream allowed.1920No
maxHeightMaximum height of a video stream allowed.1080No
maxFPSMaximum framerate for a video stream.20No