Initial setup to open lock from ESP32

Hi there,
I tried to connect with Nuki but BLE seems more complex than other protocols and after seeing documentation remains not clear to me how to operate with lock and send messages.

I started with the code of this thread modified with my address, and I’m able to connect with the lock, but I think this is only a “hello” stage, not enough to operate and send open/close messages.
There is some examples, at the bottom of the first link, but I’m new to bluetooth so I’m not able to see what are variables, what data are from documentation etc…

Can you please give me some high level examples with low level explanations?


For example:

//initial pairing
void pairing()


// operate lock.
// -status: open/close
void operate(int status)


//get battery status
int getbattery()

return batterystatus;

Your documentation seems a datasheet more than an API…

We do not cover Bluetooth basics in or API documentation but focus on GATT services, message format, encryption and commands used. So you would need to read up on the Bluetooth standards e.g. here: to get into the topic.

Regarding code samples: I am sorry to say we don’t have any available for the BLE API at the moment. If you get back to us with concrete questions we will try to help on the go.

Ok, thanks for your reply,
So you don’t provide an API, but a bluetooth protocol specification.


Did you achieve a success result? I try to do it with Swift. And I have obstacle on the kdf1 step. Seems, we have to use the same library, and I’d like to know how it to do right.

I am in process of implementing this in python.
Any help is much appreciated as I started my journey few months ago from someone’s implementation of older API. It does open, close and pair to locks.

You won’t use python (most likely since it’s a big runtime) but we could talk it over.


Unfortunately, I use C/C++/Obj-C/Swift languages.