core icon indicating copy to clipboard operation
core copied to clipboard

Nuheat Integration fails with an authentication error

Open DennisOtt-git-hub opened this issue 1 year ago • 1 comments

The problem

I had the Nuheat integration set up and working but when I did the last upgrade to my HA it failed to setup. I can log into the Nuheat website from my browser so I know the credentials and serial number are accurate. I deleted the integration and tried to reinstall but now I can't get passed the initial log in authentication configuration page.

Log entry:

2022-10-27 10:18:49.280 ERROR (MainThread) [homeassistant.components.nuheat] Failed to login to nuheat: HTTPSConnectionPool(host='www.mynuheat.com', port=443): Max retries exceeded with url: /api/authenticate/user (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x93989b68>: Failed to establish a new connection: [Errno -2] Name does not resolve'))

What version of Home Assistant Core has the issue?

core-2022.10.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Nuheat

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nuheat

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Log entry: 

2022-10-27 10:18:49.280 ERROR (MainThread) [homeassistant.components.nuheat] Failed to login to nuheat: HTTPSConnectionPool(host='www.mynuheat.com', port=443): Max retries exceeded with url: /api/authenticate/user (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x93989b68>: Failed to establish a new connection: [Errno -2] Name does not resolve'))

Additional information

No response

DennisOtt-git-hub avatar Oct 27 '22 15:10 DennisOtt-git-hub

I am experiencing the same error. I have two NuHeat floors hence the double session entry. I’m going to guess that the underlying nuheat Python library is now out of date.

log below: ———

2022-10-27 07:00:52.967 DEBUG (SyncWorker_0) [nuheat.api] Creating NuHeat session 2022-10-27 07:00:52.968 DEBUG (SyncWorker_6) [nuheat.api] Creating NuHeat session 2022-10-27 07:00:53.485 ERROR (MainThread) [homeassistant.components.nuheat] Failed to login to nuheat: Authentication error 2022-10-27 07:00:53.514 ERROR (MainThread) [homeassistant.components.nuheat] Failed to login to nuheat: Authentication error 2022-10-28 07:33:24.027 DEBUG (SyncWorker_20) [nuheat.api] Creating NuHeat session 2022-10-28 07:33:24.256 ERROR (MainThread) [homeassistant.components.nuheat] Failed to login to nuheat: Authentication error 2022-10-28 07:34:01.790 DEBUG (SyncWorker_1) [nuheat.api] Creating NuHeat session 2022-10-28 07:34:01.990 ERROR (MainThread) [homeassistant.components.nuheat] Failed to login to nuheat: Authentication error

Skyman64 avatar Oct 29 '22 21:10 Skyman64

FWIW, I haven't been seeing these problems with either 2022.10.5 or 2022.11.1.

@DennisOtt-git-hub Are you still seeing this problem? The exception you cited appears to be logged by Home Assistant here from a call to api.authenticate() in python-nuheat, which in-turn tries to POST to https://www.mynuheat.com/api/authenticate/user.

When I search for "HTTPSConnection Failed to establish a new connection Name does not resolve", it looks like when this error happens in other projects, it's been either a problem with DNS or a mal-formed URL. In this case, the URL being used (https://www.mynuheat.com/api/authenticate/user) seems fine to me (and hasn't changed in python-nuheat lately). Maybe Nuheat was doing maintenanace at the time?

@Skyman64 The error you cited ("Failed to login to nuheat: Authentication error") is a bit different. This one also appears to be logged by Home Assistant here from a call to api.authenticate() in python-nuheat. However, in your case, instead of the exception coming from the POST to https://www.mynuheat.com/api/authenticate/user, it's actually raised a few lines later when it doesn't find a SessionId in the server response.

In both cases, I'm most inclined to believe this was a case of bad timing -- Nuheat server maintenance that happened to coincide with when you upgraded Home Assistant (and therefore needed to re-authenticate with Nuheat's servers).

@DennisOtt-git-hub If you agree with this assessment and are no longer seeing this problem, please close the issue. Otherwise, please let me know what other information you think might suggest a different root cause.

tstabrawa avatar Nov 07 '22 03:11 tstabrawa

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.