npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-nuki-ble

v0.9.1

Published

A Node.JS BLE library for the Nuki Smartlock

Downloads

3

Readme

node-nuki-ble

This library provides an API to interface with a Nuki Smartlock using bluetooth.

Important Notes

  • The library has been developed with the Raspberry Pi / Raspbian in mind. It has been tested on a Raspberry Pi 3 with the latest release of Raspbian only.
  • The library has been tested with a Nuki v1. Compatibility with Nuki v2 has not been confirmed at this point. Feel free to test and post your results.
  • For bluetooth communication this library uses noble which only works with Node.JS v8. Please make sure to use the appropriate version or otherwise the library will crash.

Installation

Install the module using NPM:

$ npm install -g node-nuki-ble

Getting Started using the CLI

The module comes a CLI tool which can pair and control Nuki devices.

Pairing a new device

First a new Nuki devices need to be paired. Please follow the instructions of the Nuki manual to put it into pairing mode. Then run the following command. Replace the name with the desired display name for the pairing in the Nuki app and choose a device type.

$ nuki pair --name <name> --type <app|fob|bridge>

If the pairing completes without any error it will be store in the file pairing.bin.

Controlling the Nuki Smartlock

Once paired the following command can be user to enter the main Nuki CLI:

$ nuki cli --pairing pairing.bin
> help
The following commands are available:
 * fob1
 * fob2
 * fob3
 * help
 * lock
 * lockngo
 * lockngo-unlatch
 * pin <pin>
 * remove-authorization-entry
 * request-states
 * request-battery-report
 * request-authorization-entries
 * unlatch
 * unlock

To execute an action enter the desired command and press enter.

Getting Started using the Node.JS API

The following example demonstrates how to execute a lock action on a previously paired Nuki.

const nuki = require('node-nuki-ble'); // Returns an instance of NukiManager

(async function () {
	let pairing = nuki.pairing('pairing.bin'); // Returns an instance of NukiPairing
	let peripheral = await nuki.discoverPeripheral(pairing.macAddress); // Returns an instance of NukiPeripheral
	let lock = peripheral.lock(pairing); // Returns an instance of NukiLockService
	lock.lockAction(nuki.Constants.LockAction.Lock); // Performs the actual lock action
})();

For more examples also see the implementation of the included CLI tools and service.

Documentation

The source of this library is almost fully documented using JSDoc. The public API documentation can be found here: Public API Documentation

systemd Service

The library also comes with a systemd service which can be installed globally using the following command:

$ nuki service install --pairing ./pairing.bin

The service can either be controlled using systemctl and journalctl or by using the included CLI tool:

$ nuki service --help
Usage: nuki-service [options] [command]

Options:
  -v, --version        output the version number
  -h, --help           output usage information

Commands:
  install [options]
  uninstall [options]
  start [options]
  stop [options]
  restart [options]
  status [options]
  logs [options]

Contribution

User contributions to this library are always welcome. Please use the issues sections and feel free to create Pull Requests for bug fixes, imrovements or new features.

The library is still a work in progress. Most parts have been refined multiple times but there are still some bugs and missing features. The public API may change in the future.

Projects using this library

  • Coming SOON: homebridge-nuki-ble - A homebridge plugin for the Nuki Smartlock using the bluetooth API