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

Unexpected exception error #201

Open
jjvelar opened this issue Nov 26, 2024 · 16 comments
Open

Unexpected exception error #201

jjvelar opened this issue Nov 26, 2024 · 16 comments

Comments

@jjvelar
Copy link

jjvelar commented Nov 26, 2024

Hi,
Login process is not working and, after deleting the integration and creating again, I get the following error.
Please, advise.
Thanks!

This error originated from a custom integration.

Logger: custom_components.garmin_connect.config_flow
Source: custom_components/garmin_connect/config_flow.py:47
integration: Garmin Connect (documentation, issues)
First occurred: 7:22:30 AM (4 occurrences)
Last logged: 7:24:46 AM

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/garmin_connect/config_flow.py", line 47, in async_step_user
await self.hass.async_add_executor_job(api.login)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/garminconnect/init.py", line 181, in login
self.display_name = self.garth.profile["displayName"]
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/garth/http.py", line 104, in profile
assert isinstance(self._profile, dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

@cyberjunky
Copy link
Owner

Garmin seems to have changed their API, we are looking into fixing the underlaying library. Duplicate of #200

@cyberjunky
Copy link
Owner

Temp fixed in version 0.2.20!

@jjvelar
Copy link
Author

jjvelar commented Nov 27, 2024

can confirm it is working.
thanks!

@nckslater
Copy link

Working! Thanks 👍

@jose1711
Copy link

I updated to 0.2.22 and restarted HA, still getting:

Traceback (most recent call last):
  File "/config/custom_components/garmin_connect/__init__.py", line 82, in async_login
    await self.hass.async_add_executor_job(self._api.login)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.12/site-packages/garminconnect/__init__.py", line 212, in login
    self.display_name = self.garth.profile["displayName"]
                        ^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.12/site-packages/garth/http.py", line 104, in profile
    assert isinstance(self._profile, dict)

@bogdandinga
Copy link

I can confirm that I'm getting the same error

@jonwilliams84
Copy link

+1 here. Not much help I know but happy to know I am not on my own. :-)

@Fleischpirat
Copy link

Hey there,
I think the problem here is the 2-factor security introduced by Garmin. After logging in, you normally receive a security code by e-mail. The query was probably not built into the integration here. Unfortunately, I am not a developer myself. Can someone check this?

@jose1711
Copy link

No 2FA here and Garmin integration documents the need to disable it anyway.

@drwahl
Copy link

drwahl commented Dec 10, 2024

I just got a new Garmin watch and was trying to get this working. After reading about the 2FA issue, I tried to disable 2FA on my brand new account. It seems like Garmin has "permanent 2FA" set on new accounts, so I cannot disable it. So for any accounts created going forward, it seems like this won't work until/unless 2FA is supported by this plugin.

@dgolovach
Copy link

It looks like it's broken again (clean install and same garth issue).

@cyberjunky
Copy link
Owner

@dgolovach should be fixed in last version, can you try?

@jose1711
Copy link

Still seeing the same error in 0.2.26

@cyberjunky
Copy link
Owner

Still seeing the same error in 0.2.26

Which error exactly? Can you post part of log?

@jose1711
Copy link

Still seeing the same error in 0.2.26

Which error exactly? Can you post part of log?

ESC[31m2024-12-20 14:35:30.975 ERROR (MainThread) [custom_components.garmin_connect] Unknown error occurred during Garmin Connect login reque
st
Traceback (most recent call last):
  File "/config/custom_components/garmin_connect/__init__.py", line 82, in async_login
    await self.hass.async_add_executor_job(self._api.login)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.12/site-packages/garminconnect/__init__.py", line 212, in login
    self.display_name = self.garth.profile["displayName"]
                        ^^^^^^^^^^^^^^^^^^
  File "/config/deps/lib/python3.12/site-packages/garth/http.py", line 104, in profile
    assert isinstance(self._profile, dict)
AssertionErrorESC[0m

@PauloGoncalves86
Copy link

PauloGoncalves86 commented Jan 9, 2025

Hello,

I was having a similar error, related to MFA. When I switched it off, it logged in. Perhaps the reason for the need to login again was relate to disruption yesterday with Garmin servers. Anyway, I switched MFA back on on my login and will keep an eye.

My log is below, in case it helps. MFA is here to stay, I reckon. Some of the exposed functionality will always be a magnet for malicious activity.

**This error originated from a custom integration.

Logger: custom_components.garmin_connect
Source: custom_components/garmin_connect/init.py:82
integration: Garmin Connect (documentation, issues)
First occurred: 8 January 2025 at 00:40:41 (3 occurrences)
Last logged: 08:46:18

Unknown error occurred during Garmin Connect login request
Traceback (most recent call last):
File "/config/custom_components/garmin_connect/init.py", line 82, in async_login
await self.hass.async_add_executor_job(self._api.login)
File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.13/site-packages/garminconnect/init.py", line 239, in login
self.display_name = self.garth.profile["displayName"]
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/garth/http.py", line 107, in profile
return self.user_profile
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/garth/http.py", line 97, in user_profile
self._user_profile = self.connectapi(
~~~~~~~~~~~~~~~^
"/userprofile-service/socialProfile"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/garth/http.py", line 177, in connectapi
resp = self.request(method, "connectapi", path, api=True, kwargs)
File "/usr/local/lib/python3.13/site-packages/garth/http.py", line 132, in request
if not self.oauth2_token or self.oauth2_token.expired:
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'expired'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants