It is an odroid N2 blue with HA OS
Home Assistant 2022.12.8
Supervisor 2022.11.2
Operating System 9.4
Frontend 20221213.1 - latest
If you are running OS, you don’t need to find the IP since the container can be accessed through localhost. You should then be using 127.0.0.1
You may also need to set the port after the ip 127.0.0.1:8080
or the port you set in the configuration.
Also make sure the addon is running, check the logs for any error message, try to make a request to the port where the addon is running:
curl localhost:8080
I’ve got the following Error.
Traceback (most recent call last):
File "/opt/./nuki.py", line 547, in _notification_handler
command, data = await self._parse_command(uncrypted)
File "/opt/./nuki.py", line 424, in _parse_command
"current_time": datetime.datetime(values[3], values[4], values[5],
ValueError: year 0 is out of range
This a Python that indicates a problem converting some times/dates. It looks like the date is incorrect. Is your OS date correct? Try to find a command to list it. Also try to reboot the system (not HA but the OS)
You will need to investigate by yourself that error. Try to look at the addon logs but also on the supervisor logs (Settings > System > Logs and select Supervisor on the top right dropdown)
The date looks fine. I started again from the beginning and now I have a different error.
2023-01-01 09:42:22.258|E|nuki.py:653|Error while sending data on attempt 1
2023-01-01 09:42:22.258|E|nuki.py:654|[org.bluez.Error.Failed] le-connection-abort-by-local
Traceback (most recent call last):
File "/opt/./nuki.py", line 644, in task
await self.connect()
File "/opt/./nuki.py", line 677, in connect
await self._client.connect()
File "/usr/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 278, in connect
assert_reply(reply)
File "/usr/lib/python3.9/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local
2023-01-01 09:42:22.459|I|nuki.py:642|Trying to send data. Attempt 2
Any idea how to fix this?
You need to be more specific when asking questions. Here read this:
https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question
Then, think that people are not at your computer and don’t know what you did, tried, which addon or integration threw that error or why.
You need to explain the scenario, the steps you followed, at what step did this error appear and what have you tried to solve it. Then we may be able to help you, but throwing some log messages won’t give enough information.
You also said in a previous comment that you successfully paired the lock and got the lock key. Is this error after pairing? Before finishing the addon installation?
You are right, I haven’t thought about this. So I will explain more detailed about the steps I took and were I’m stuck.
My homeassistant installation (I think it is HA OS) runs on a home assistant blue (odroid N2+) preinstalled.
These are the versions:
Home Assistant 2022.12.8
Supervisor 2022.12.1
Operating System 9.4
Frontend 20221213.1 - latest
-
I set up the nuki 3.0 pro.
-
I installed the nuki bridge add-on and the nuki lock integration of HACS
-
Then I followed the instructions of the add-on for pairing the lock with the add-on.
-
I received the api token in the nuki bridge add-on
-
now I’ve tried to use this api Token with the nuki lock integration. As host or ip I’ve tried different things:
-
172.0.01 with or without port 8080 (as configured in the add-on)
-
172.30.33.10 (received by using the command in your step 4 of the initial post) with or without port
-
I tried also using the hostname displayed on the information page of the add-on (4b34517f-nuki-bridge) with or without port
and this is wat I always see:
Then I looked into the protocol of the add on and I saw this error message:
2023-01-01 14:24:45.218|E|nuki.py:653|Error while sending data on attempt 1
2023-01-01 14:24:45.218|E|nuki.py:654|[org.bluez.Error.Failed] le-connection-abort-by-local
Traceback (most recent call last):
File "/opt/./nuki.py", line 644, in task
await self.connect()
File "/opt/./nuki.py", line 677, in connect
await self._client.connect()
File "/usr/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 278, in connect
assert_reply(reply)
File "/usr/lib/python3.9/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local
In the supervisor log I could see no errors.
So I got the add-on running but I can’t install the integration either the official nuki nor the nuki ng. I don’t know if I have to install a different Version of bluez on the odroid to get this working.
I could see the smart lock in the I beacon tracker integration.
I’m using bluetooth also for other things and it works.
So I don’t know how to get this working.
In which port did you configure the bridge?
It seems to me that the bridge is not accessible from HA. Open a console in the HA machine (ODROID for you) and run:
netstat -naep | grep <your_port>
Replacing <your_port>
with the port that the bridge is using.
That output shouldn’t show all that connections. Don’t you have something else running on that port so the bridge server can’t start?
Run
docker ps | grep nuki
Post the output so we can check the port mapping.
Also you can change the port of the addon to something different. I have mine running on 8087
and try the pair the integration again.
Hey guys, I’m on the same boat here.
Home Assistant 2022.12.8
Supervisor 2022.12.1
Operating System 9.4
Frontend-versie: 20221213.1 - latest
In the log of the nuki virtual bridge it says service is running on http://0.0.0.0:8080. Doesn’t change when changing ports either.
If anything needed to help out, let me know.
@DevoEvoLevo that’s because it is running in a docker container, which uses port mapping between the container and the host. The bridge runs on the 8080 and is not aware of that mapping. Docker then maps the specified port on the config to the internal port. So connections received on the container’s external portl, et’s say port 8087, will be redirected to the 8080 internal port.
Also further debugging steps would be:
-
Get a shell into the container with
docker exec -it <container_name> bash
and runpython3 /opt/main.py --lock
. The file may be named differently so check the existing files in the/opt
die.
This should lock the Nuki Lock -
Call the addon using curl and passing thr bridge token.
The Nuki-Bridge container?
Yes, the ome returned by docker ps
This is the output of the terminal after the lock command, but the lock is still unlocked.
Ok so now we knoeñw the problem is with the bridge itself we can take HA and network issues out of the equation. I’ve been reading the code and that error originates when calling a command and the queue has not started, which makes me think that the pairing was not successfull. Few things:
- Which Nuki Lock do you have?
- Do you have multiple Locks or Nuki devices?
- Were there any other erros during the add-on installation? Please re-install it from scratch and post any other errors.
I saw you opened an issue in the addon’s Github repo and that’s were this discussion should be addressed since we know now it’s not a problem related to HA. Although let’s try to fix it here.
Thank you for the support and your patience. I will install everything new this evening, when I am at home.
I hope Im not interfering with @Daniel76 here.
So I configured the add-on Virtual Nuki Bridge. Followed the steps in the documentation and the log shows no error regarding connection to Nuki device over Bluetooth. Sends and receives.
When using one of the two integrations I try to use the IP for localhost and include the port as set up in the add on: http://127.0.0.1:8087
In the logs I find the following error.
Failed to get list of devices from bridge: HTTPConnectionPool(host='127.0.0.1', port=80): Max retries exceeded with url: /info?token=xxx (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f667524a530>: Failed to establish a new connection: [Errno 111] Connection refused'))
Failed to get list of devices from bridge: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: //127.0.0.1:80/info?token=xxxx (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6674e1cd30>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
Failed to get list of devices from bridge: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: //127.0.0.1:8087/info?token=xxx (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6674b42290>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
To show the configuration running on the add on see here:
-----------------------------------------------------------
Add-on: Nuki Bridge
Virtual Nuki Bridge to use instead of the physical device
-----------------------------------------------------------
Add-on version: 0.0.23
You are running the latest version of this add-on.
System: Home Assistant OS 9.4 (amd64 / generic-x86-64)
Home Assistant Core: 2022.12.8
Home Assistant Supervisor: 2022.12.1
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2023-01-02 19:50:36.888|I|config.py:72|********************************************************************
2023-01-02 19:50:36.888|I|config.py:73|* *
2023-01-02 19:50:36.888|I|config.py:74|* Access Token *
2023-01-02 19:50:36.888|I|config.py:75|* xxxxxxxxx *
2023-01-02 19:50:36.889|I|config.py:76|* *
2023-01-02 19:50:36.889|I|config.py:77|********************************************************************
2023-01-02 19:50:36.896|I|nuki.py:254|Waiting for more tasks with timeout
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
2023-01-02 19:50:46.907|I|nuki.py:258|No more tasks - cleaning up
2023-01-02 19:50:46.908|I|nuki.py:181|Starting a scan
2023-01-02 19:50:46.908|I|nuki.py:184|Scanning attempt 1
2023-01-02 19:50:46.989|I|nuki.py:186|Scanning succeeded on attempt 1
2023-01-02 19:50:46.989|I|nuki.py:267|Waiting for next task
2023-01-02 19:50:49.201|I|nuki.py:221|Nuki: 54:D2:72:BA:19:EC, adapter: hci0, RSSI: -51 AdvertisementData(local_name='Nuki_2EBA19EC', manufacturer_data={76: b'\x02\x15\xa9.\xe2\x00U\x01\x11\xe4\x91l\x08\x00 \x0c\x9af.\xba\x19\xec\xc8'}, service_data={'a92ee100-5501-11e4-916c-0800200c9a66': b'.\xba\x19\xec'}, service_uuids=['0000003e-0000-1000-8000-0026bb765291', '00000044-0000-1000-8000-0026bb765291', '00000045-0000-1000-8000-0026bb765291', '00000055-0000-1000-8000-0026bb765291', '00000096-0000-1000-8000-0026bb765291', '000000a2-0000-1000-8000-0026bb765291', '00001800-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb', 'a92ee100-5501-11e4-916c-0800200c9a66', 'a92ee200-5501-11e4-916c-0800200c9a66'])
2023-01-02 19:50:49.203|I|nuki.py:198|Stop scanning
2023-01-02 19:50:49.222|I|nuki.py:201|Scanning stopped
2023-01-02 19:50:49.223|I|nuki.py:275|Working on task
2023-01-02 19:50:49.223|I|nuki.py:676|Nuki connecting
2023-01-02 19:50:52.012|I|nuki.py:367|Device type: DeviceType.SMARTLOCK_1_2
2023-01-02 19:50:52.078|I|nuki.py:688|Connected
2023-01-02 19:50:52.078|I|nuki.py:277|Finished task
2023-01-02 19:50:52.079|I|nuki.py:254|Waiting for more tasks with timeout
2023-01-02 19:50:52.080|I|nuki.py:701|Querying Nuki state
2023-01-02 19:50:52.081|I|nuki.py:275|Working on task
2023-01-02 19:50:52.082|I|nuki.py:642|Trying to send data. Attempt 1
2023-01-02 19:50:52.082|I|nuki.py:674|Connected
2023-01-02 19:50:52.082|I|nuki.py:647|Sending data to a92ee202-5501-11e4-916c-0800200c9a66: b'c\x1bY\xde\xe0\xb8\xc9\xe5\xeb#\xc6_J\xc8\xbc\x18\xb0\xac\xffF\xf8\x9d\\\xd6\xe6\\4\x00\x1a\x00\xf4\xaa!J\x8f\xee\t1\xd2(\xf7\x90\x98\x04\x8e\xab.)\x96"vB~\xdd\xcc\xcc'
2023-01-02 19:50:52.106|I|nuki.py:657|Data sent on attempt 1
2023-01-02 19:50:52.107|I|nuki.py:277|Finished task
2023-01-02
Some details:
- Using a Unifi Network application on port 8080, hence my config change to 8087.
- I retried installing the add-on and thus repairing the nuki. It seems connected and functioning as expected.
I hope you can give me any lead on what’s next…