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

Current beta can't be set up #292

Closed
Thomas55555 opened this issue Dec 7, 2024 · 3 comments
Closed

Current beta can't be set up #292

Thomas55555 opened this issue Dec 7, 2024 · 3 comments

Comments

@Thomas55555
Copy link
Contributor

Thomas55555 commented Dec 7, 2024

The problem

After updating, the integration can't be loaded.

What version of MBAPI2020 do use?

v0.21.0-beta.1

What was the last working version of MBAPI2020?

No response

What type of installation are you running?

Home Assistant OS

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-12-07 13:10:08.367 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration mbapi2020 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-12-07 13:10:12.184 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting: https://id.mercedes-benz.com/as/token.oauth2 - 0 - {"error_description":"unknown, invalid, or expired refresh token","error":"invalid_grant"}
2024-12-07 13:10:12.184 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xxx@xxx.com (Region: Europe) for mbapi2020
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/__init__.py", line 62, in async_setup_entry
    token_info = await coordinator.client.oauth.async_get_cached_token()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/oauth.py", line 193, in async_get_cached_token
    token_info = await self.async_refresh_access_token(token_info["refresh_token"], is_retry=False)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/oauth.py", line 142, in async_refresh_access_token
    if "access_token" not in token_info:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
2024-12-07 13:10:15.466 ERROR (MainThread) [homeassistant.components.home_connect.switch] An error occurred: {'description': 'HomeAppliance is offline', 'key': 'SDK.Error.HomeAppliance.Connection.Initialization.Failed'}
2024-12-07 14:11:32.327 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting: https://id.mercedes-benz.com/as/token.oauth2 - 0 - {"error_description":"unknown, invalid, or expired refresh token","error":"invalid_grant"}
2024-12-07 14:11:32.327 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xxx@xxx.com (Region: Europe) for mbapi2020
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/__init__.py", line 62, in async_setup_entry
    token_info = await coordinator.client.oauth.async_get_cached_token()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/oauth.py", line 193, in async_get_cached_token
    token_info = await self.async_refresh_access_token(token_info["refresh_token"], is_retry=False)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/oauth.py", line 142, in async_refresh_access_token
    if "access_token" not in token_info:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
2024-12-07 14:11:47.201 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting: https://id.mercedes-benz.com/as/token.oauth2 - 0 - {"error_description":"unknown, invalid, or expired refresh token","error":"invalid_grant"}
2024-12-07 14:11:47.201 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xxx@xxx.com (Region: Europe) for mbapi2020
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/__init__.py", line 62, in async_setup_entry
    token_info = await coordinator.client.oauth.async_get_cached_token()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/oauth.py", line 193, in async_get_cached_token
    token_info = await self.async_refresh_access_token(token_info["refresh_token"], is_retry=False)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/oauth.py", line 142, in async_refresh_access_token
    if "access_token" not in token_info:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Additional information

No response

@ReneNulschDE
Copy link
Owner

Thanks for the test. The error happens when the MB-Authentication server did not delivered a correct token. I see this too 1-2 per year. I'll change the code and publish a new test version.

You could delete the integration and add it again until the new release is available.

Thanks again.

@ReneNulschDE
Copy link
Owner

Fixed in v0.21.0-beta.2

@Thomas55555
Copy link
Contributor Author

Thanks. Reauthentication is now working

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

2 participants