NUKI Hub firmware for the ESP32

Thanks a lot for this project, it is really amazing.

First time playing with a esp32 and in 10 minutes my nuki hub was working.

Sometimes when I open or close the door with HA takes a few second to show the updated state in HA, is it normal this delay?

It is a Nuki v4 (no pro) and I used a ESP32 ESP-WROOM-32, wifi signal is very good (-40dbm) and BT around -65dbm (1 m).


Yes, the delay is normal.

1 Like

Since some people liked the solution on github for the presence sensor, i post this again on the “right” forum. To use nuki hub for presence, just add this as an mqtt sensor:

    - name: "nuki_presence_sensor"
      state_topic: "nuki/presence/devices"
      value_template: "{{ 'home' if 'YOUR-iBEACON-ID' in value else 'not_home' }}"
      unique_id: "nuki/presence/devices_uid"

Then you have a sensor if your iBeacon ID is recognized by NukiHUB, home if recognized and not_home if you are away.

For having a sensor for the rssi, just use:

    - name: "nuki_esp32_lock_rssi"
      state_topic: "nuki/lock/rssi"
      value_template: "{{ value }}"
      unique_id: nuki_esp32_nuki_lock_rssi_unique_id

Maybe it helps the one or other

Sorry I wasn’t clear on GitHub, I meant the rssi for the beacon not the lock :slight_smile:

I’ve been using the above to open the lock since yesterday and it opens well before I reach the door, definitely better than nuki’s auto unlock.

With a bit of automation I switch on the ble transmitter on the ha app as I enter the home zone and off after an unlock. Great stuff!

Ahh, ok. This is not just so easy, beside i am not a templating expert.
Maybe some of the really advanced users here have an idea for us.
Nuki gives us a text string like this:

4b:75:18:xx:xx:xx;Galaxy Watch4 (FKXF);-82

I would think the most easy way would be, ha converts this to json and then we would search the right name and pick the value from this data set, but i don’t know how this is done exactly in a template.
Maybe @123 oder @Didgeridrew have an idea when reading this?

FAQ Guideline 16 - Should I tag people?

Oh my bad, i was not aware of that rule. Sorry that i tagged you, but i have read so many threads where both you made advanced templates, so i thought you could help us here.
Again sorry that i made some circumstances for you and didgeridrew.

Hello guys, thanks for this amazing project! I’m currently facing the following behavior:
if I use the function lock’n’go, the state of the lock in Homeassistant stays “open”, while the Nuki is locked, so the state is not synchronized. What I’m doing wrong? Thanks!

{% set entry_list = 
4b:75:18:xx:xx:xx;Galaxy Watch4 (FKXF);-82
54:d2:xx:xx:xx:ad;Nuki_1C4705AD;-56' %}

{% set pos = entry_list.find('Galaxy Watch4') %}
{% set pos2 = entry_list[pos:].find('\n') %}

{{ entry_list[pos:pos+pos2].split(';')[1] }}

I’m not sure this is the most efficient way of extracting it but hopefully this helps as a starter

1 Like

I don’t know also, but it is a way to extract and it works, many thanks. It’s far beyond my knowledge, but in a quiet minute i will try to understand the logic.
Since it wasn’t for me, @xaris33 here is the mqtt sensor for the rssi of your beacon:

    - name: "nuki_esp32_presence_rssi"
      state_topic: "nuki/presence/devices"
      value_template: >
        {% set nuki_list = value %}
        {% set pos = nuki_list.find('YOUR-iBEACON-ID') %}
        {% set pos2 = nuki_list[pos:].find('\n') %}
        {{ nuki_list[pos:pos+pos2].split(';')[1] }}
      unique_id: nuki_esp32_nuki_presence_rssi_unique_id

All credits goes to Josh for this wonderful solution!!!


I am trying to get a nukihub running here but the image flash constantly fails at exact 63%: with error “serial port is not ready. close any other application using it and try again”

  • already tried various cables
  • already tried other ESP32 (same type, which already worked as bluetooth proxy in home assistant
  • shall i try different type of ESP32 ? (C maybe??)

any other hint to get this done ?
thanx in advance

ok … interesting

  • just tried it with webflash on a raspi5
  • and it suceeded !
  • never trust a windows machine
    but still I am curios what the problem is - as I saw that also on the raspi at exact 63% it kind of was stuck shortly and then immediatly switched to 100% and installation complete
    very strange … looks like some final steps in the flash process which fail on the windows machine => will try another windows machine to check whether its an instance problem of that one windows setup
    will keep you posted


The NUKIHUB works great, thank you very much.

Does anyone have any tips for me on how to write an automation that flashes an LED every time the NUKI latch is unlocked. Even if the door is opened with Autounlock via the Nuki APP.

Thank you

I installed Nuki Hub fresh and it works very well :slight_smile: thx a lot.

I have used the MQTT auto discovery.

I have activated the unlatch in Home Assistant and I can unlatch and receive the log in home assistant.
However, If I open the door with keypad no message appears.
I only see messages if door is locked or unlocked, no unlatch.

Is there a chance to get this message?

From GitHub:

MQTT Interface


  • lock/state: Reports the current lock state as a string. Possible values are: uncalibrated, locked, unlocked, unlatched, unlockedLnga, unlatching, bootRun, motorBlocked

next question from my side is how to pair Nuki opener with nukihub:

  • I checked the “opener enabled” checkbox in nukihub admin gui
  • I started the opener setup in Nuki app and came to the subprocess where it says to press opener button for 10 seconds to put opener in pairing mode with bridge (which I assume is surrogates by the nukihub esp32)
  • I tried to reboot the nukihub, as this also worked to pair it with Nuki lock
  • BUT nothing happens
  • and nukihub web gui still shows “opener paired” as disabled

am I missing something ? or is in this case the nukihub not meant to act as a bridge …


You might need to try several times (and/or move the ESP closer), the opener’s BLE signal is weaker than the lock’s in my experience.

-You should hold the button for 5 seconds, not 10 (the light should be on, not flashing).
-Try disabling and re-enabling the bluetooth pairing from the app (In the Nuki smartphone app, go to “Settings” → “Features & Configuration” → “Button & LED” and make sure “Bluetooh Pairing” is enabled.). This worked for me.

so there is no explicit way to put the nukihub I to pairing mode ?

  • I actually read the setup instructions from opener wrong
  • it says that the bridge (aka nukihub) needs to be put in pairing mode to connect the opener
    hmmm… somehow stuck here …

1 Like

There is: You power-cycle the ESP.