Skip to content

ebaauw/homebridge-nb

Repository files navigation

Homebridge NB

Downloads Version Homebridge Discord verified-by-homebridge

GitHub issues GitHub pull requests JavaScript Style Guide

Homebridge plugin for Nuki Bridge

Copyright © 2020-2024 Erik Baauw. All rights reserved.

This Homebridge plugin exposes Nuki Smart Lock and Nuki Opener devices, connected to a Nuki Bridge, to Apple's HomeKit. It provides the following features:

  • Expose each Nuki Bridge as separate accessory with a custom service. Home shows this accessory as Not Supported in Home, but is required for Homebridge NB. In Eve and other HomeKit apps, this accessory provides control of the polling rate, the level of logging, and rebooting the Bridge.
    In future, this accessory might become a separate bridge.
  • Expose each Nuki Smart Lock as a separate accessory, with a Lock Mechanism service to control the lock, and a Battery service for the battery. The when present and configured, door sensor is exposed as separate Contact Sensor service, including Eve history.
  • Expose each Nuki Opener as separate accessory, with a Doorbell service for the ringer, a Lock Mechanism service for the opener, and a Battery Service for the battery.
  • Zero configuration:
    • Automatic discovery of Nuki Bridge and paired Smart Lock and Opener devices.
    • Automatic configuration of API token. The token is persisted across Homebridge restarts (in the Bridge accessory).
  • Technical:
    • Use local API provided by the Nuki Bridge; no Internet connection needed (except for discovery of the Bridge).
    • Use hashed tokens for added security.
    • Subscribe to Nuki Bridge for notifications on device state changes.
    • Use Identify on the Smart Lock and Opener accessories to force the Bridge to contact the device and refresh the cached device state.

Prerequisites

Homebridge NB communicates with the Nuki Bridge using the local Nuki Bridge HTTP API. You need to enable this API through the Nuki app.

Use Eve to get the full functionality, like history for the door sensor, and support for Ring to Open and Continuous Mode on the Opener.

Command-Line Tool

Homebridge NB includes a command-line tool, nb, to interact with the Nuki Bridge from the comand line. It takes a -h or --help argument to provide a brief overview of its functionality and command-line arguments.

Installation

To install Homebridge NB:

  • Follow the instructions on the Homebridge Wiki to install Node.js and Homebridge;
  • Install the Homebridge NB plugin through Homebridge Config UI X or manually by:
    $ sudo npm -g i homebridge-nb
    
  • Edit config.json and add the NB platform provided by Homebridge NB, see Homebridge Configuration;
  • Run Homebrdige NB for the first time, and press the button on the Nuki bridge. The bridge should be discovered automatically. Pressing the button allows Homebridge NB to obtain a token (API key).

Configuration

In Homebridge's config.json you need to specify Homebridge NB as a platform plugin.

  "platforms": [
    {
      "platform": "NB"
    }
  ]