[RELEASE] Nuki web API driver (Works without the bridge)

Hi fellas,

I just created a small driver to connect HE with a Nuki smart lock, configured with the Nuki Web API.

The benefit of this driver is control of your Nuki smart locks without a Nuki Bridge (so it needs internet access).

Since I only have a Nuki 3.0 Pro, I have tested this driver with a Nuki 3.0 Pro only.

Driver :
https://raw.githubusercontent.com/vpsupun/hubitat/master/NukiWebAPI.groovy

How to obtain the 'Nuki API Token':

  1. Login to Nuki Web
  2. Click 'Generate API Tocken' button under ' API tokens'
  3. Copy that token

I spent only one to two hours on this driver, so it might not work perfectly. Please let me know if you find any bugs.

P. S. : I'm not a developer by profession. So my code might be ugly :face_with_peeking_eye: . But it will work for sure :sunglasses:

2 Likes

Updates :

  • Added a feature to get upto date about the new updates ( update information )
  • Started using state variables instead of attributes
  • Handled some error situations

Thanks for this – exactly what I've been looking for to complement what the Nuki app and HomeKit can do :+1:

1 Like

Very new to Hubitat. Please may someone explain the benefits of integrating my Nuki lock with Hubitat, in layman’s terms?

The same as with any other lock. Use event based triggers to control the lock.

And use events from the lock to trigger other automations.

With my zigbee locks, these are the types of automations I used:

  1. Automatically keep the back door unlocked when someone was home, and automatically lock it when everyone left.

  2. On specific days, activate a lock code for the housekeeper, and inactivate it after they left the house.

  3. Turn on certain lights when the housekeeper used their lock code to enter, and disable other automations. Also, set an HVAC comfort profile.

  4. Send me a notification when the housekeeper left, turn off lights, and enable certain automations.

etc etc

Thank you very much, and setting these automations in the hub would mean local and therefore responsive activation?

If you used a zigbee or z-wave lock that is controlled locally by the hub.

Hi @user6476 & @aaiyar ,

This is NOT a Zigbee or Z-Wave driver. Nuki does NOT support it.

This drivers uses the Nuki web API for the remote operation.

Using this driver, you can lock, unlock, unlatch your Nuki lock. And it can get the locking status of the door and the battery status.

In order to use this driver, you need the Nuki web API token. You can simply generate one from here.

I'll update the main post with this details to avoid confusions.

I'm using this driver to fully lock my door at night ( during the daytime, it was just latched. At night it locks my 3 point door lock ) and unlock in the morning.

And I monitor it's battery using HE single batter monitoring rule.

Will this driver work with the new version of Nuki lock v4?

Hi,

I can have a look tonight. But I might not be able to test because I don't own the new Nuki device.

I checked it. According to the web API guide, there's no difference. If you have a device with you, please test it and let me know the feedback. Thanks

I have the nuki 4.0 pro working a treat using this driver so thank you!

However, ive tried to add a second lock for a different door and the api cant seem to work out that there is a second lock to open and opens the first lock when i ask hubitat to open the second. The devices look slightly different on the hubitat device pages so im not sure what im getting wrong or if the api integration just cant handle 2 locks.

Has anyone else got 2 nuki locks working on the integration? Or any advice for troubleshooting?

Hi,

Thank you for using this driver.

To be honest, I didn't design this driver to work with multiple locks. I fetch the lockID from Nuki and use that ID to operate the lock.

But let me check the code and find out why it's not working for multiple locks. It should be something related to variables.

I'll try to modify this before the weekend, but I appreciate it if you can help me to test it.

Cheers,
Supun

I just checked the code again.

It should be able to handle two locks.

Please make sure your lock name (in 'Nuki Smart Lock Name (case sensitive) *' ) is correctly set according to the lock names mentioned in the Nuki Web

Please let me know If the lock names are different and set correctly yet the locking doesn't work properly.

Sorry i missed your responses here.

The lock names in hubitat do match the lock names on Nuki web but when i ask hubitat to lock the back door (2nd lock) the front door lock actually locks

I see.

Could you please confirm the 'lastLockId : ' value under 'State Variables' has two different values for both locks (don't share the lockID with me) ?

Thank you for helping me with this. I don't have anything under state variables?