Nubli is a Node.JS library for Nuki Smart Locks (Nuki Bluetooth Library) Nubli is very energy efficient when used properly and should't drain more power than a Nuki bridge. It uses the same protocol the App and Bridge uses and therefore communicates securely with the Smart Lock.
- Get Lock State of Nuki Smart Lock (including door sensor)
- Unlock/Lock/Unlatch/LockNGo Door
- Listen for Lock State and Door Sensor changes
- Get Authorizations
- Get Configuration
- Get Advanced Configuration
- Nuki Smart Lock v2
- Nuki Smart Lock v1 (not yet 100% compatible - Please open an issue if something doesn't work)
- Linux-based Server (e.g. Raspberry Pi)
- Bluetooth 4.x Dongle (Tested with $5 CSR Module)
Note: Do not use the built-in Bluetooth in a Raspberry Pi. Due to bad hardware design it will not reliably connect to your Smart Lock and cause unexpected disconnects. I've been there and invested a whole week into fixing it.
Setup / Installation
- You can only run one instance of this library simultaneously with one dongle. If want to integrate this library into multiple applications running at the same time on the same device, either pin the applications to different bluetooth dongles or communicate with a single instance of this library via a webserver/websocket/mqtt instead.
Start Scanning for Nuki devices
Start Actively Scanning for Nuki devices (Required for pairing)
- Scanning requires the bluetooth device to be powered on. This may take a few milliseconds. Make sure to wait for the promise
nubli.readyToScan()to resolve first.
- Only use active scanning when you are trying to pair a new device. Active Scanning will drain your Smart Lock's battery very quickly. Passive Scanning only listens for advertisements from the Smart Lock and does not request additionaly information from the Smart Lock.
Stop Scanning for Nuki devices
Connect to a Smart Lock
Disconnect from a Smart Lock
Check if a config for the Smart Lock already exists
smartlock.configExistspath?: string: boolean;
Read Smart Lock config
smartlock.readConfigpath?: string: Promise<void>;
Save Smart Lock config
smartlock.saveConfigpath?: string: Promise<void>;
Pair with a Smart Lock
smartlock.pairasBridge = true: Promise<void>;
Note: By default it will pair as bridge. If you do have a bridge, make sure to pass false as a parameter. The reason is, that when no bridge exists, Nuki will not push any state changes automatically via advertisements, so we set ourselves as a bridge instead.
Read lock state from Smart Lock
Lock N Go Door
Lock N Go Unlatch Door
Get Config from Smart Lock
Get Advanced Config from Smart Lock
Check whether a Smart Lock is already paired
Nubli Smart Lock Discovered Event
Nubli started scanning
Nubli stopped scanning
Smart Lock Connected Event
Smart Lock Disconnected Event
Smart Lock Error Event
Smart Lock Activity Log Changed Event
activityLogChanged event only works while scanning because the Smart Lock advertises activity log changes via bluetooth. To get notified when the door opens or closes (Door Sensor) make sure to enable 'Log door sensor status' in the Nuki app.
If you have any questions or help please open an issue on the GitHub project page.
Pull requests are always welcome. If you have an issue or feature request please open a GitHub issue.
The project is subject to the MIT license unless otherwise noted. A copy can be found in the root directory of the project LICENSE.