skodaconnect / homeassistant-myskoda

Homeassistant integration for MySkoda.
97 stars 17 forks source link

Login fails after update to new release #372

Open networxnet opened 4 days ago

networxnet commented 4 days ago

After updating to newest release 1.12.1 login fails.

"Ein unerwarteter Fehler ist aufgetreten" ist Show after entering E-Mail and Password.

Update:

Seems you have to agree some new annoying marketing consents from skoda.

Log off from app, login again and answer the marketing consents. After this login in HA is possible again.

pawelaugustyn commented 4 days ago

It's worth noting that the old Skoda Connect integration showed a more precise error (Missing consent for client "technical" scopes) while the new integration limited the output to Config entry 'my-mail@mydomain.com' for myskoda integration could not authenticate

WebSpider commented 3 days ago

It seems that we only fixed this error occurring in a running instance, not upon startup/restart.

pawelaugustyn commented 3 days ago

I'm doing a daily backup that includes both full stop and start of my HA instance (for the db integrity). That's why I noticed that

henrik-farre commented 3 days ago

Log:

2024-12-01 16:20:13.194 WARNING (MainThread) [homeassistant.config_entries] Config entry 'xxx@redacted.xxx' for myskoda integration could not authenticate
2024-12-01 16:20:13.946 ERROR (MainThread) [homeassistant] Error doing job: Unclosed client session (None)
2024-12-01 16:20:13.946 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/myskoda/auth/authorization.py", line 77, in authorize
    self.idk_session = await self._get_idk_session()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/auth/authorization.py", line 222, in _get_idk_session
    authentication = await self._enter_password(login_meta)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/auth/authorization.py", line 167, in _enter_password
    location = response.headers["Location"]
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'Location'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/config/custom_components/myskoda/__init__.py", line 60, in async_setup_entry
    await myskoda.connect(config.data["email"], config.data["password"])
  File "/usr/local/lib/python3.12/site-packages/myskoda/myskoda.py", line 128, in connect
    await self.authorization.authorize(email, password)
  File "/usr/local/lib/python3.12/site-packages/myskoda/auth/authorization.py", line 79, in authorize
    raise AuthorizationFailedError from ex
myskoda.auth.authorization.AuthorizationFailedError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/myskoda/__init__.py", line 63, in async_setup_entry
    raise ConfigEntryAuthFailed from exc
homeassistant.exceptions.ConfigEntryAuthFailed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1088, in _async_init_reauth
    result = await hass.config_entries.flow.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1301, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1336, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 513, in _async_handle_step
    self._raise_if_step_does_not_exist(flow, step_id)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 592, in _raise_if_step_does_not_exist
    raise UnknownStep(
homeassistant.data_entry_flow.UnknownStep: Handler ConfigEntriesFlowManager doesn't support step reauth
nils512 commented 2 days ago

is there any workaround?

WebSpider commented 2 days ago

Log off from app, login again and answer the marketing consents. After this login in HA is possible again.

networxnet commented 2 days ago

is there any workaround?

Did you read my first post?

nils512 commented 2 days ago

is there any workaround?

Did you read my first post?

Sorry, now i did. Works again :-) Thank you!

WebSpider commented 1 day ago

It's worth noting that the old Skoda Connect integration showed a more precise error (Missing consent for client "technical" scopes) while the new integration limited the output to Config entry 'my-mail@mydomain.com' for myskoda integration could not authenticate

Yeah, the SkodaConnect integration was more mature in these aspects, absolutely. We're getting there ;-)

dvx76 commented 1 day ago

To confirm, the bug to be fixed here is to also catch the TermsAndConditons exception in the ConfigFlow instead of just the init?