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

Unable to log in and add TotalConnect integration #132236

Closed
gibwar opened this issue Dec 4, 2024 · 7 comments · Fixed by #132531
Closed

Unable to log in and add TotalConnect integration #132236

gibwar opened this issue Dec 4, 2024 · 7 comments · Fixed by #132531

Comments

@gibwar
Copy link
Contributor

gibwar commented Dec 4, 2024

The problem

When attempting to log in to TotalConnect I get an error TypeError: 'NoneType' object is not subscriptable. Digging in to the issue, the login process is failing. I confirmed I can log in to the UI client with the username and password provided so the account is active and working.

What version of Home Assistant Core has the issue?

core-2024.11.3

What was the last working version of Home Assistant Core?

core-2024.10.4

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Total Connect

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

logger:
  default: info
  logs:
    homeassistant.loader: warning
    homeassistant.setup: warning
    homeassistant.components.totalconnect: debug
    total_connect_client: debug
    zeep.transports: debug

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:635
First occurred: 21:57:14 (1 occurrences)
Last logged: 21:57:14

Error setting up entry Total Connect for totalconnect
Traceback (most recent call last):
  File "/srv/ha-2024.11.3/lib/python3.12/site-packages/homeassistant/config_entries.py", line 635, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/ha-2024.11.3/lib/python3.12/site-packages/homeassistant/components/totalconnect/__init__.py", line 32, in async_setup_entry
    client = await hass.async_add_executor_job(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/ha-2024.11.3/lib/python3.12/site-packages/total_connect_client/client.py", line 96, in __init__
    self.authenticate()
  File "/srv/ha-2024.11.3/lib/python3.12/site-packages/total_connect_client/client.py", line 296, in authenticate
    response = self.request(
               ^^^^^^^^^^^^^
  File "/srv/ha-2024.11.3/lib/python3.12/site-packages/total_connect_client/client.py", line 235, in request
    self._raise_for_retry(response)
  File "/srv/ha-2024.11.3/lib/python3.12/site-packages/total_connect_client/client.py", line 157, in _raise_for_retry
    rc = _ResultCode.from_response(response)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/ha-2024.11.3/lib/python3.12/site-packages/total_connect_client/const.py", line 151, in from_response
    return _ResultCode(response_dict["ResultCode"])
                       ~~~~~~~~~~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Debug Details

2024-12-03 22:31:04.943 DEBUG (SyncWorker_13) [zeep.transports] Loading remote data from: https://rs.alarmnet.com/TC21api/tc2.asmx?WSDL
2024-12-03 22:31:05.381 DEBUG (SyncWorker_13) [zeep.transports] Loading remote data from: http://schemas.xmlsoap.org/soap/encoding/
2024-12-03 22:31:06.248 DEBUG (SyncWorker_13) [total_connect_client.client] sending API request LoginAndGetSessionDetails('[user]', '[pass]', '14588', '1.0.34')
2024-12-03 22:31:06.257 DEBUG (SyncWorker_13) [zeep.transports] HTTP Post to https://rs.alarmnet.com/TC21api/tc2.asmx:
<?xml version='1.0' encoding='utf-8'?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Body><ns0:LoginAndGetSessionDetails xmlns:ns0="https://services.alarmnet.com/TC2/"><ns0:userName>[user]</ns0:userName><ns0:password>[pass]</ns0:password><ns0:ApplicationID>14588</ns0:ApplicationID><ns0:ApplicationVersion>1.0.34</ns0:ApplicationVersion></ns0:LoginAndGetSessionDetails></soap-env:Body></soap-env:Envelope>
2024-12-03 22:31:06.341 DEBUG (SyncWorker_13) [zeep.transports] HTTP Response from https://rs.alarmnet.com/TC21api/tc2.asmx (status: 200):
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><LoginAndGetSessionDetailsResponse xmlns="https://services.alarmnet.com/TC2/" /></soap:Body></soap:Envelope>

Additional information

I removed my username and password from the debug details and replaced them with [user] and [pass] respectively. They are correctly formatted and work on the main Total Connect web interface. I'm not sure if they need to be escaped, but the password does contain the following special characters throughout: -+=_#. Ignore the difference in timestamps as the debug output was from my dev instance so I could step through the code.

I did try downgrading my dev instance back to 2024.10.4 and the problem still presents itself so it's not necessarily an upgrade issue, more of the fact that restarting HA started the login process that fails with this error now.

Looking at https://rs.alarmnet.com/TC21api/tc2.asmx?op=LoginAndGetSessionDetails there is a LocaleCode parameter that we're not passing but I'm not sure if that's required.

@home-assistant
Copy link

home-assistant bot commented Dec 4, 2024

Hey there @austinmroczek, mind taking a look at this issue as it has been labeled with an integration (totalconnect) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of totalconnect can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign totalconnect Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


totalconnect documentation
totalconnect source
(message by IssueLinks)

@mclever
Copy link

mclever commented Dec 4, 2024

I was hoping it would fix itself overnight...

@austinmroczek
Copy link
Contributor

I saw in the logs that my system had the same error. When I reloaded the integration just now, it is working.

Per https://status.resideo.com the system was down last night / early today for maintenance, and users were reporting problems. It did not specifically state issues with Total Connect 2.0, but in the past their status postings have been not been the most precise.

I know I need to update the documentation to include that status link, but other than that I don't think this is an HA bug.

@austinmroczek
Copy link
Contributor

In the total_connect_client package I will ensure a ServiceUnavailable exception is thrown, which will result in HA users seeing a log message with:

                Error connecting to TotalConnect or the service is unavailable.
                Check https://status.resideo.com/ for outages.

This message already appears in some other similar cases

@gibwar
Copy link
Contributor Author

gibwar commented Dec 4, 2024

I noticed the same thing too - that I reloaded it this morning and it was working, so definitely not a HA/integration bug at its core. There may be an opportunity to handle the error like you mentioned, especially so it can trigger occasional restarts with HA to possibly auto-heal. It looks like there's retry logic in there that this managed to escape. Thanks for taking a look!

@gibwar
Copy link
Contributor Author

gibwar commented Dec 4, 2024

If you'd like to close this issue, feel free. If you'd like to use it for any work coming from it and would like it open, that's fine with me as well!

@austinmroczek
Copy link
Contributor

I'll keep it open until fixed. Thanks for reporting it.

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

Successfully merging a pull request may close this issue.

3 participants