kvj / hass_nuki_ng

Better support for Nuki devices in the Home Assistant
MIT License
177 stars 34 forks source link

Error while fetching auth - Message in HA Log. #21

Open magicbenny opened 2 years ago

magicbenny commented 2 years ago

Don´t know for how long but I receive the below message in my HA Log. Integration works fine but I like to have clean log files if possible. Any idea what this can be?

Using Nuki NG Custom Component latest Version and latest HA Version 2021.12.1 but this error appears already before updating.

Thx for helping if possible.

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.nuki_ng.nuki Source: custom_components/nuki_ng/nuki.py:40 Integration: Nuki Lock (documentation, issues) First occurred: 08:23:55 (19 occurrences) Last logged: 08:32:56

Error while fetching auth: Traceback (most recent call last): File "/config/custom_components/nuki_ng/nuki.py", line 284, in _update item["web_auth"] = await self.api.web_list_all_auths(dev_id) File "/config/custom_components/nuki_ng/nuki.py", line 155, in web_list_all_auths response = await self.web_async_json( File "/config/custom_components/nuki_ng/nuki.py", line 143, in web_async_json return await self.async_json(lambda r: cb(r, { File "/config/custom_components/nuki_ng/nuki.py", line 40, in async_json raise ConnectionError(f"Http response: {response.status_code}") ConnectionError: Http response: 401

kvj commented 2 years ago

Hi, have you entered a Web API token while configuring the integration? It looks like the token is present, but invalid

magicbenny commented 2 years ago

Hi, have you entered a Web API token while configuring the integration? It looks like the token is present, but invalid

yes I had. what is strange is the fact that integration works pretty fine but still this error message.

kvj commented 2 years ago

the fact that integration works pretty fine

Web API part of the integration is optional.

You can verify the validity of your token using curl:

curl -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" "https://api.nuki.io/smartlock/auth"

Where $TOKEN is your Web API token you've created

ccapndave commented 2 years ago

I don't know if this is still relevant, but I got this error because the bridge had stopped serving http pages. Simply unplugging it and plugging it back in fixed the problem.