Using Nuki Lock 3.0 Fully Local without Bridge

Can you try what I posted as first option in this comment?

Output:

root@4b34517f-nuki-bridge:/opt$ python3 /opt/main.py --lock
2023-01-08 12:08:13.301|I|config.py:72|***************************************** ***************************
2023-01-08 12:08:13.302|I|config.py:73|* *
2023-01-08 12:08:13.302|I|config.py:74|* Access Token *
2023-01-08 12:08:13.303|I|config.py:75|* blablabla *
2023-01-08 12:08:13.303|I|config.py:76|* *
2023-01-08 12:08:13.304|I|config.py:77|***************************************** ***************************
2023-01-08 12:08:13.309|I|nuki.py:708|Locking nuki
Traceback (most recent call last):
File “/opt/main.py”, line 95, in
asyncio.run(device.lock())
File “/usr/lib/python3.9/asyncio/runners.py”, line 44, in run
return loop.run_until_complete(main)
File “/usr/lib/python3.9/asyncio/base_events.py”, line 642, in run_until_compl ete
return future.result()
File “/opt/nuki.py”, line 712, in lock
await self._send_data(self._BLE_CHAR, cmd)
File “/opt/nuki.py”, line 659, in _send_data
await self.manager.taskQueue.add_task(task)
File “/opt/nuki.py”, line 306, in add_task
await self._queue.put(wrapper_task)
AttributeError: ‘NoneType’ object has no attribute ‘put’

This is the exact same issue that @Daniel76 had.

This is the comment on how he solved it:

So I got it finally working, but I did a few mistakes.
First of all I had the internal WLAN enabled in my SL3.0 Pro which isn’t supposed to work with the Nuki Bridge or the Raspi Nuki Bridge together. It has to be the one or the other.
Next problem was the Bluetooth dongle. I now use an extension cable. I think this was the reason for better bluetooth connection. Finally I should have read the initial post more carefully about restarting the bridge after pairing. I couldn’t get the integration nuki ng setup without this restart.

Try to go through this and all the steps on the OP and it should work.

First of all I am really thankful for your help and time.
As my is the Nuki 3.0 non-pro, there isn’t the “WLAN enabled” problem like @Daniel76
Then, I don’t have a Nuki Bridge as he has.
On the distance, my rpi3b+ is now less than 1 meter from the lock, with no objects between. Unfortubatly i don’t have an BT dongle to test but i believe BT from rpi3b+ should work.
As for the restarting the bridge fater pairing, I don’t see it written on the main post, can you explain me please?
Thank you so much

You are welcome. He does not have a bridge either. He meant the addon.

I have the RPi3B+ also and it works so Bluetooth shouldn’t be the problem either.

Uninstall the addon, pair the lock with the smartphone app, pair it with the addon, restart the addon, configure the integration.
Let’s see if that way it works.

You should be following the addon installation guide that I linked:

Could this also be done with the ESPHome Bluetooth proxy since my pi is not really close to the Nuki?

Yes it should. I’ve seen there is even firmware to have an ESP32 as the bridge: https://www.google.com/url?sa=t&source=web&rct=j&url=https://community.home-assistant.io/t/nuki-hub-firmware-for-the-esp32/417572&ved=2ahUKEwizlKzZqrj8AhUSPOwKHbufBIMQFnoECA0QAQ&usg=AOvVaw0Nq-EIRpB_lqloxcCPVhTG

Ok, so i made it.
There were 2 things i was missing and only now i put them together.
1 - The messaged “Pairing completed!” only shows on the very first try after the addon is installed. So o each try, i had to remove and install again the addon
2 - This one was the most important. After showing “Pairing completed” and show the access token, i restarted the addon, and made it work. Somehow, this restart in not (or i didn’t see it) on the OP so i was not doing, and only did it after was advised here to do it.

So, THANKS! And my sugestion is to put the need to restart the addon after the parigint completed and the access token retrieved.

One interresting thing I experienced after the core update and restart of Homeassistant all nuki entities were unavailable. I couldn’t bring them back at first. Only a complete reboot of my odroid N2 braught all entities back and functional.

So this might be interresting for other people, too.

I have done all the steps but when configuring the Nuki Lock integration i dont know what to put exactly

Nuki bridge hostname or IP address : ip of the raspberry? In my case I am using a raspi zero w to control the nuki
Home assistant internal url: url with port?
Bridge Api token: I am using a raspberrry so what is the token??
Web api token: same as bridge?

Best regards

Dude this is some basic stuff. I can’t spend my time helping everyone about everything.

You need to read the guide and the addon documentation and think about what each field can be. Come on is not thst hard!

1 Like

I already read the addon documentation and as you can see is always refering to the official nuki bridge, not to this case

This is not the documentation of the addon. It’s the documentation for the Integration.

@victorigualada thanks for the post.

In my case, I’ve installed the bridge as a add-on and it conencts to the lock wihtout problems.

The issue I’m having is with the Nuke add-onn accessing the bridge. I get the error Invalid Token (i’ve oened an issue).

In my case, if I follow your guiadance of identifying the container IP Address, it does seem to work. Only if I use the standard address 127.0.0.1

I know it because using the container IP Address I don’t get any log when Nuki add-on tries to register to the bridge. However, if I use the container’s IP address, no access log from Nuki addon are registered.

Awesome guide, I managed to get my Nuki connected with the addon, thanks a lot.

Out of curiosity: how responsive is the HA/nuki communication in your system? I mean:

  • How long it takes from the moment a lock command is issued from HA until it is executed?
  • When the Nuki state changes (eg door becomes locked), how long until HA sees the change?

For anyone watching this thread, it might be worth trying this project instead:

It basically turns a $10 ESP32 into a hub for the nuki. Very easy to setup and worked much better for me than the solution of this post. I get almost instant responsiveness (although the reason is likely the fact that I can put the ESP32 much closer to the nuki than my RPI is). It also seems well maintained and has some nice features like auto-retrying a lock command if it fails.

The best part: nothing else is needed on the HA side! No custom integrations, no addons that might break at any moment. The lock is autodetected via MQTT (only needs an MQTT broker that most people have anyway).

It’s still not perfect since you need an ESP32 just for nuki. I hope in the near future someone makes a nuki integration that uses HA’s recent bluetooth API (which will automatically allow to use ESP32 devices as proxies!). But until then nuki_hub seems like the best solution.

6 Likes

Ciao ci sei riuscito alla fine? Io no:(

how did you get that widget with fingerprint authentication in the Companion App?

Hello, I would like to use the Home Assistant as the Nuki bridge but unfortunately, I am getting the same error again :frowning:

I am using a separate supported USB Stick (Maxuni BT-501 (RTL8761BU ) (hci1).

I installed the Nuki add-on, changed the config adapter from hci0 to hci1, started the pairing mode on the Nuki Lock 3.0, started the add-on, waited a couple of seconds, and refreshed the Log.

 Add-on version: 0.0.23
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.2.2
 Home Assistant Supervisor: 2023.01.1
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/./__main__.py", line 66, in <module>
    nuki_manager, data = init_config(config_file, addon_config_file)
  File "/opt/./config.py", line 98, in init_config
    if len(nuki_devices) > 1:
TypeError: object of type 'NoneType' has no len()
[cmd] python3 exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I already restarted and installed the addon a couple of times and put the Rasp. next to the Nuki Lock. Removed the Bluetooth Stick and used the internal Bluetooth adapter w/o changing the config file from hci0 to hci1. But it did not help.

Thanks in advance :slight_smile: