skodaconnect / homeassistant-myskoda

Homeassistant integration for MySkoda.
19 stars 5 forks source link

Backoff failed login #91

Open WebSpider opened 2 weeks ago

WebSpider commented 2 weeks ago

When login fails, we attempt to re-login every second.

This does not really make sense and hammers Skoda/vwg auth servers

WebSpider commented 2 weeks ago

Failed logins that are because of an incorrect password end up in the logs like this:

2024-10-14 17:00:21.300 ERROR (MainThread) [custom_components.myskoda] Login with MySkoda failed.
  File "/home/me/dev/core/config/custom_components/myskoda/__init__.py", line 40, in async_setup_entry
    await myskoda.connect(config.data["email"], config.data["password"])
  File "/home/me/.virtualenvs/homeassistant-skoda/lib/python3.12/site-packages/myskoda/myskoda.py", line 89, in connect
  File "/home/me/.virtualenvs/homeassistant-skoda/lib/python3.12/site-packages/myskoda/auth/authorization.py", line 74, in authorize
  File "/home/me/.virtualenvs/homeassistant-skoda/lib/python3.12/site-packages/myskoda/auth/authorization.py", line 212, in _get_idk_session
  File "/home/me/.virtualenvs/homeassistant-skoda/lib/python3.12/site-packages/myskoda/auth/authorization.py", line 157, in _enter_password

We could maybe handle this better by implementing https://developers.home-assistant.io/docs/integration_setup_failures#handling-expired-credentials

WebSpider commented 2 weeks ago

Screenshot of end-user experience image

Since we can conclude this is an authentication error, we might as well inform the user a bit better :+1: