Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuki 2.0 smartlock fails to setup #41827

Closed
xanthox opened this issue Oct 14, 2020 · 22 comments
Closed

Nuki 2.0 smartlock fails to setup #41827

xanthox opened this issue Oct 14, 2020 · 22 comments
Assignees

Comments

@xanthox
Copy link

xanthox commented Oct 14, 2020

My new Nuki 2.0 doorlock does not seem to setup in HA. Does not work in 0.115 and in my current version of HA.

I have this in my configuration.yaml (from the HA integration page). I tested with and without the port, but the error stays the same.

lock:
  - platform: nuki
    host: Static IP
    token: (10 digit alphanumeric)
    port: 8080

After I reboot HA I always get this log:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/nuki/lock.py", line 61, in setup_platform devices = [NukiLockEntity(lock) for lock in bridge.locks] File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 234, in locks return self._get_devices(device_type=const.DEVICE_TYPE_LOCK) File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 199, in _get_devices for l in self.list(device_type=device_type): File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 128, in list data = self.__rq("list") File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 107, in __rq data = result.json() File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting ',' delimiter or '}': line 1 column 51 (char 50)

Running version 0.116.1 (as mentioned, 0.115 did not work either)
Supervisor version: 247

@probot-home-assistant
Copy link

Hey there @pschmitt, @pvizeli, mind taking a look at this issue as its been labeled with an integration (nuki) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@pschmitt
Copy link
Contributor

Are you using a software bridge by any chance?

@xanthox
Copy link
Author

xanthox commented Oct 16, 2020

No, hardware bridge

@Stewie3112
Copy link

same here, just installed a nuki lock + bridge and no entity is created. Even no errors in logs!

@tristanXme
Copy link

you use the wrong token, you have to take the token from the bridge, not from the web api.

The "local" bridge token is only 6 characters long

@mamoel666
Copy link

mamoel666 commented Oct 30, 2020

Even in the official documentation (HA) the token has a length of 8 characters.
What is the "local" bridge token?

@xanthox
Copy link
Author

xanthox commented Oct 30, 2020

It is the token in your hardware bridge, the one you can manage using the app. I have set it to 10 tokens.

@tristanXme
Copy link

I mean the "local" http-Api there also is the "web-api" that you can configure online on the nuki website. That one got a "long" token.

The web-api got a 6 digit token
https://developer.nuki.io/t/bridge-http-api/26
https://developer.nuki.io/uploads/short-url/zFqVWVR2GvBzvVAk23E8fbRG9Fm.pdf

So if you use that token it should Work.

@tristanXme
Copy link

It is the token in your hardware bridge, the one you can manage using the app. I have set it to 10 tokens.

Alright, okay. So thats the correct one - anyway, mine does also not work anymore as it runs in an timeout for sometime now. Sadly there seems nobody to activly develop this integration.

@mamoel666
Copy link

mamoel666 commented Oct 30, 2020

In my case it suddenly stopped working (with a token that had been working for about a year). In the bridge log I see that the brige's wifi does a reset as soon as HA tries to connect.
Strange thing is, that this reset even occurs if I use a "RESTful" sensor in HA but not if I enter the URL in a browser.

If I start an iobroker test system, the connection works without problems.

@Komplizio
Copy link

Being rather new to home assistant on my Raspberry Pi this is an issue I also have. After restarting HA it works for a few minutes (sometimes hours) until it stops to work and then the only way to get it back to work is a HA restart.

My config is a rather default one. If there is anything I, as a non developer, can do to help here I would be happy to do so.

lock:
  - platform: nuki
    host: 192.168.188.201
    port: 8080
    token: ******

@Komplizio
Copy link

Being rather new to home assistant on my Raspberry Pi this is an issue I also have. After restarting HA it works for a few minutes (sometimes hours) until it stops to work and then the only way to get it back to work is a HA restart.

My config is a rather default one. If there is anything I, as a non developer, can do to help here I would be happy to do so.

lock:
  - platform: nuki
    host: 192.168.188.201
    port: 8080
    token: ******

Update: For me this is working again since one of the more recent updated without any issues ever since.

@tobi-blue
Copy link

Dear all,
i think i had the same issues and on my point of view i could track this down to my network configuration.
I have firewalled the nuki hardware bridge because i dont want it to communicate to the internet.

First HA connection got killed because nuki got no NTP Time Update and HA uses a key combined with timestamp for its api calls.
Async time will prevent a successfull api call.
-> i Opned port ntp udp/123 only = it was instant available
Second it got unavailable after a few days to HA (Same network, no firewall between nuki and HA)
-> I opned internet completly for nuki again = it was instant available.

I dont have the possibility to analyse the IP and Ports needed for nuki Bridge to work properly but please check if your restricted internet connectivity could be the problem too?
Perhaps we can solve this topic if everybody could link my answer to their posts and the issue for all is found?

pp.
Another Topic seems to have the same issue because they solved it by reconfigure the nuki python file to to unsecure token communication. If i do my API Calls with the clear token it does not need a time stamp and will work everytime even without internet. (Test API Call in Browser: http://192.168.***.***:8080/list?token=***)

@xanthox
Copy link
Author

xanthox commented Feb 24, 2021

Well I checked if NTP could be an issue, but the bridge has unrestricted access to the internet. If I open the bridge URL in a browser I can see the correct timestamp as JSON output.

It still gives the same error:

2021-02-24 10:22:53 ERROR (MainThread) [homeassistant.components.lock] Error while setting up nuki platform for lock Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 198, in _async_setup_platform await asyncio.shield(task) File "/usr/src/homeassistant/homeassistant/components/nuki/lock.py", line 55, in async_setup_platform entities = await hass.async_add_executor_job(get_entities) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/nuki/lock.py", line 51, in get_entities entities = [NukiLockEntity(lock) for lock in bridge.locks] File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 234, in locks return self._get_devices(device_type=const.DEVICE_TYPE_LOCK) File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 199, in _get_devices for l in self.list(device_type=device_type): File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 128, in list data = self.__rq("list") File "/usr/local/lib/python3.8/site-packages/pynuki/bridge.py", line 107, in __rq data = result.json() File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting ',' delimiter or '}': line 1 column 51 (char 50)

Version core-2021.2.3
supervisor-2021.02.11
Nuki 2.0 and Hardware bridgje

I have even reset the token to something else to see if that helps but no.

I installed the VM of Home Assistant OS using Virtualbox (https://www.home-assistant.io/installation/linux) and added only the Nuki integration. The same error occurs.

@TheDK
Copy link

TheDK commented Feb 24, 2021

I have two Nuki 2.0 smart locks connected to one Nuki Bridge configured like this in locks.yaml:

- platform: nuki
  host: 192.168.23.30
  token: <6 character token from Nuki App>

It worked from day 1 for ~ 4 weeks now. Setup:

System Health

version core-2021.2.3
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.7.19
arch aarch64
timezone Europe/Berlin
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4998
Installed Version 1.11.3
Stage running
Available Repositories 749
Installed Repositories 10
Home Assistant Cloud
logged_in true
subscription_expiration 12. März 2021, 01:00
relayer_connected true
remote_enabled false
remote_connected false
alexa_enabled true
google_enabled false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Hass.io
host_os HassOS 4.20
update_channel stable
supervisor_version supervisor-2021.02.11
docker_version 19.03.12
disk_total 113.9 GB
disk_used 4.0 GB
healthy true
supported true
board odroid-n2
supervisor_api ok
version_api ok
installed_addons File editor (5.2.0), Check Home Assistant configuration (3.6.0), FTP (4.0.1), Terminal & SSH (9.0.1), Duck DNS (1.12.5), Log Viewer (0.9.1)
Lovelace
dashboards 2
resources 4
views 12
mode storage

@xanthox
Copy link
Author

xanthox commented Feb 24, 2021

@TheDK could you share your hardware bridge settings perhaps? I have changed the token again to a six character one (since you have that) but I still get the same error.

Under Dev options under the Nuki Bridge I have enabled:

  • API fast discovery
  • HTTP API

I see the IP which I use in the config.yaml, the port and my API token I use.

The firmware of the bridge is version 2.9.1

@TheDK
Copy link

TheDK commented Feb 24, 2021

Sure:
grafik

@xanthox
Copy link
Author

xanthox commented Feb 24, 2021

Thanks! I have the same settings though so it has to be something else. What bothers me that in a clean install (VM) of Home Assistant I get the same error.

@TheDK
Copy link

TheDK commented Feb 25, 2021

Are you using the a fully supervised image or only HA core? I'm running a test environment using VirtualBox on a Windows server with this image: https://github.com/home-assistant/operating-system/releases/download/5.12/hassos_ova-5.12.vdi.xz
There the locks also work fine...

@xanthox
Copy link
Author

xanthox commented Feb 25, 2021

Yes! That the same one I have used in Virtualbox for testing.

@xanthox
Copy link
Author

xanthox commented Feb 25, 2021

OMG! I feel such a dumb person!. I was debugging this and I saw that the name of the lock was between quotes. So the JSON output on the cmdline looked like:

`[{"deviceType": 0, "nukiId": xxxxxx, "name": ""The Cave" entrance"...

I have removed the quotes in the name and guess what, it is now working!

@xanthox xanthox closed this as completed Feb 25, 2021
@TheDK
Copy link

TheDK commented Feb 25, 2021

PBSC (problem between screen and chair) - happens... :)

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants