Closed jmcollin78 closed 1 year ago
No, you're missing the first field: IP address of the bridge
I don't have any bridge as explained
It seems that the Hostname or IP address of the host is mandatory. I put localhost on this field (and I don't have any bridge) and it seems to work.
The bridge address should not be mandatory if you configure the web token, that's how the component goes into web polling mode.
Are you using the privacy mode of the browser to configure things? Please don't use that, it should work without these workarounds.
Yes I was in privacy mode. Ok I will try in normal mode.
Here you can see this user configured it in web polling mode: https://github.com/kvj/hass_nuki_ng/issues/67#issuecomment-1165952635
But it seems he had the same issue as you...so probably it's a bug. Hope @kvj will track it down.
Huumm, putting localhost on "hostname or IP" is certainly not a good idea. My log are full of this error:
2022-06-25 17:49:58 ERROR (MainThread) [custom_components.nuki_ng.nuki] Error while fetching auth:
Traceback (most recent call last):
File "/config/custom_components/nuki_ng/nuki.py", line 356, in _update
item["web_auth"] = await self.api.web_list_all_auths(dev_id)
File "/config/custom_components/nuki_ng/nuki.py", line 188, in web_list_all_auths
response = await self.web_async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 176, in web_async_json
return await self.async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 38, in async_json
raise ConnectionError(f"Http response: {response.status_code}")
ConnectionError: Http response: 401
as the issue described here: https://github.com/kvj/hass_nuki_ng/issues/21
Note that the integration works perfectly
Can you do one last try: put None
in that field. The problem is that it should be an optional field, and it seems like it's mandatory. Try with None
to see if we can bypass it safely for now.
The address field is optional. The error message about the malformed input isn't coming from the integration, but from the Home Assistant. Let me try to do a little trick.
Generally speaking, to configure Nuki 3.0 without a bridge you only need a web token and nothing else
The address field is optional. The error message about the malformed input isn't coming from the integration, but from the Home Assistant. Let me try to do a little trick.
I know it was optional, I looked at the code. Nevertheless, without it, it threw the error.
So instead of returning None
you used ""
and it fixes it? It was an HA issue?
So instead of returning None you used "" and it fixes it? It was an HA issue?
Yeah, for some reason config flow expects right data types as initial values or nothing
Thank you for your fix. Do I have to wait for an official HA release or is it possible to install the fix alone ? Sorry the update is visible in HACS. I will try this now and let you know
It is working as expected now. Thank you for your fix speed !
Hello, one more precision. I look into my logs this morning and I see that I've got many errors like this one (one per 30/sec):
2022-07-29 07:45:08 ERROR (MainThread) [custom_components.nuki_ng.nuki] Error while fetching auth:
Traceback (most recent call last):
File "/config/custom_components/nuki_ng/nuki.py", line 356, in _update
item["web_auth"] = await self.api.web_list_all_auths(dev_id)
File "/config/custom_components/nuki_ng/nuki.py", line 188, in web_list_all_auths
response = await self.web_async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 176, in web_async_json
return await self.async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 38, in async_json
raise ConnectionError(f"Http response: {response.status_code}")
ConnectionError: Http response: 401
As far as I can see, I've got this error since a reinstall Nuki integration with the fix described above and leave the bridge field empty. This is the same error as when I type "localhost" in the bridge field (because It was mandatory). Do I need to reopen the case ? I guess yes.
Hello, my Nuki device configuration seems good (found in core.config_entries):
{
"entry_id": "54a8d17e2xxxx2255b",
"version": 1,
"domain": "nuki_ng",
"title": "Verrou porte entrée",
"data": {
"hass_url": "http://xxx.xxx.xxx.xxx:8123",
"web_token": "x",
"name": "Verrou porte entrée",
"update_seconds": 30,
"address": "",
"token": "",
"use_hashed": false
},
"options": {},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
},
This log every 30 sec is very annoying as it makes many writes on the filesystem which is not good for SSD memory card.
For those who can be interested here in a configuration to put into your configuration.yaml to avoid the log error:
logger:
default: info
filters:
custom_components.nuki_ng.nuki:
- 'Error while fetching auth'
Hey,
it seems your Web token is invalid, and this error has nothing to do with the Bridge configuration
Hi @kvj , thank you for your reply. I guess my token is valid because I can succesfully command my Nuki with Home Assistant. Nevertheless, I wanted to generate a new token but I didn't find into the documentation how to set a new token. Any help would be appreciated
May be it is possible to change the token directly in the file core.config_entries. I find something like this:
{
"entry_id": "54a8d1xxxxxxx2255b",
"version": 1,
"domain": "nuki_ng",
"title": "Verrou porte entrée",
"data": {
"hass_url": "http://<myip>:8123",
"web_token": "9de787xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx37b7ab7",
"name": "Verrou porte entrée",
"update_seconds": 30,
"address": "",
"token": "",
"use_hashed": false
},
"options": {},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
},
If it is not dangerous I will try to update directly this file and then restart Home Assistant
I create a new token, put the new value in the web_token attribute and restart. I still have the issue:
2022-08-31 08:46:59.377 WARNING (MainThread) [custom_components.nuki_ng.nuki] Despite being configured, Web API request has failed
2022-08-31 08:46:59.381 ERROR (MainThread) [custom_components.nuki_ng.nuki] Error while fetching auth:
Traceback (most recent call last):
File "/config/custom_components/nuki_ng/nuki.py", line 415, in _update
item["web_auth"] = await self.api.web_list_all_auths(web_id)
File "/config/custom_components/nuki_ng/nuki.py", line 215, in web_list_all_auths
response = await self.web_async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 184, in web_async_json
return await self.async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 39, in async_json
raise ConnectionError(f"Http response for {response.request.url}: {response.status_code} {response.reason}")
ConnectionError: Http response for https://api.nuki.io/smartlock/292865238500/auth: 401 Unauthorized
Can someone post the Nuli entry in the core.config_entries please to compare. Thanks in advance
@jmcollin78 why not to delete the integration and add it again? You won't even loose the entity history nor automations (unless you will give a new name)
I already do that in june with the first problem I have with the bridge URL. I can redo that once more. (this week-end only). What I think is very curious is that it works normally. I can command the Lock, have the status,...
What I think is very curious is that it works normally
Well, as only one web API command fails, I suspect that your Web token doesn't have the permission (scope) to read and control authorization entries
This is interesting. I don't set all permissions to the token indeed:
That for security reason but I will try with all permissions.
With all permissions the error have disappear. Do you know if there is a minimal configuration of permissions ? Are they all required ?
Reinstalling the integration have solve the issue.
Hello,
I've got a Smart Lock V3.0 PRO which is working normally. I wanted to add it into home assistant. After adding the integration, create an Web Api Token in Nuki web with success:
Then I'm stuck in the configuration window of the integration:
The error message "User Input malformed..." seems indicating the URL or hostname of the bridge is mandatory, but I don't have any bridge and I want only to use the Cloud mode.
Any clues on what I'm doing wrong ?