daernsinstantfortress / cupra_we_connect

Cupra integration for Home Assistant
Apache License 2.0
59 stars 8 forks source link

Unexpected error when logging in #80

Open terminajet opened 3 months ago

terminajet commented 3 months ago

Hi there, I'm new on HA but i'm trying to add my vehicle (Cupra leon sportstourer PHEV) to HA. My account on MyCupra is working well. I have followed the instructions to install Cupra Weconnect and everything worked fine until the login window. I write my username and password and i have an error message saying "Unexpected error".

HA is running on a raspberry Pi 4 with HA OS.

Could someone help me?

Regards

novisys commented 3 months ago

Have the same problem and tried some ideas (like changing password/ disconnect app/ reset all apps authorisation/ reinstall integration from scratch...) but nothing's done.

ECOS-GmbH commented 3 months ago

We have the same problem. The following error is logged:

This error originated from a custom integration.

Logger: custom_components.cupra_we_connect.config_flow
Source: custom_components/cupra_we_connect/config_flow.py:75
integration: Cupra WeConnect (documentation, issues)
First occurred: 13:20:11 (2 occurrences)
Last logged: 13:21:01

Unexpected exception during setup
Traceback (most recent call last):
  File "/config/custom_components/cupra_we_connect/config_flow.py", line 75, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/cupra_we_connect/config_flow.py", line 50, in validate_input
    await hass.async_add_executor_job(we_connect.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/weconnect_cupra/weconnect_cupra.py", line 166, in login
    self.__session.login()
  File "/usr/local/lib/python3.12/site-packages/weconnect_cupra/api/cupra/auth/my_cupra_session.py", line 47, in login
    response = self.doWebAuth(authorizationUrl)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/weconnect_cupra/api/cupra/auth/my_cupra_session.py", line 191, in doWebAuth
    raise APICompatibilityError('No user id provided')
weconnect_cupra.errors.APICompatibilityError: No user id provided
haydnw commented 3 months ago

I'm getting the same error as @ECOS-GmbH. Running latest release of the integration, and recently upgraded to HA 2024.8.2. I think the error started at that point, but can't swear to it.

Core 2024.8.2 Supervisor 2024.08.0 Operating System 13.0 Frontend 20240809.0

Cupra app is still working fine on my phone.

haydnw commented 3 months ago

Just checked some logs; integration definitely stopped working when I did the HA 2024.8.2 upgrade.

terminajet commented 3 months ago

Hi everybody, Thanks for your support. I have an old computer with Proxmox and HA on it. Maybe i can try to downgrade HA to try logging in cupra weconnect. But i will need a little help because i'm new at HA. Is it possible to downgrade HA to an older version?

haydnw commented 2 months ago

After four days I have just been prompted to agree to new T&Cs in the Cupra app, and this integration now works again. I have no idea how that timing ties up with the HA upgrade. 🤷‍♂️

terminajet commented 2 months ago

Hi all, Unfortunately I tried again today to log in the integration and I keep getting the same 'unexpected error' message. @haydnw : Do you have an EV Cupra borne or a PHEV vehicle? @ECOS-GmbH : How did you get this log? I wanna see what mine says.

Regards

terminajet commented 2 months ago

Hey, I just managed to log. I tried to log on the website and it looks like I didn't accept some consent. After that I managed to log in the integration.

Hope it helps

daernsinstantfortress commented 2 months ago

I have no idea how that timing ties up with the HA upgrade.

It doesn't I'm afraid. No change in behaviour on this HA release so just a coincidence, I'm afraid. Plenty of other people have also had issues related to the new consents too and I suspect that the reload of the integration from the restart meant that the re-authentication (which only happens on startup) failed after the upgrade. At this time, the root cause (and fix) is to accept the consents in the official app.

haydnw commented 2 months ago

Thanks as always. I'd desperately tried to not jump to conclusions, and had been using the app in the intervening four days without having to accept the new T&Cs. I'd even logged out and back in again in case that was the issue, having been stung before. Oh well, the hidden world of Cupra's back-end infrastructure strikes again!

12retord commented 2 months ago

Hello, same Problem here, but i‘m not able to find the T&C to accept them. I have a Seat Tarraco, a Cupra Born and had a VW Golf, do my VW ID works fine with all cars. But in which app/ which website are the T&C? My CUPRA, my Seat, Seat Connect, Volkswagen, We Connect Go. Or somewhere else? The Seat Integration works fine in HA, but it is not possible to integrate the Cupra born.

ECOS-GmbH commented 2 months ago

Hello, we solved the Problem by login to the Web-Portal and acknowledged some of the data-privacy questions. This got the integration to work.

haydnw commented 2 months ago

But in which app/ which website are the T&C? My CUPRA, my Seat, Seat Connect, Volkswagen, We Connect Go. I have always acknowledged T&Cs through the My CUPRA app.

=======================

I got an error after restarting from the latest HACS update, but as @daernsinstantfortress pointed out this is likely due to the HA restart rather than the HACS update. My workflow now whenever I need to restart HA is:

Sign out of My CUPRA app > Remove device from this integration > Restart HA > Sign in to My CUPRA app > Add device/integration again

Yorkie71 commented 2 months ago

Sign out of My CUPRA app > Remove device from this integration > Restart HA > Sign in to My CUPRA app > Add device/integration again

That's interesting because I have never had to go through that and have also updated HACS the other day.

haydnw commented 2 months ago

Sounds like a me problem then. I'll avoid clogging this issue up any more. :)

daernsinstantfortress commented 2 months ago

Yeah, definitely don't need to do any of that. I restart HA all of the time for various changes and can't remember when I last removed and re-added my car!

12retord commented 2 months ago

No way for me to get it activated. Same error again and again. I‘ve tried to log-out in all Apps, Websites, deleate the Seat and the Cupra Addon, reinstalled it, the Seat App (which has the same log-in information) works fine. Has someone else also an additional user activated for the car (maybe that could be a reason). I‘m thankfull for any hints you can give to me…

Boran commented 2 months ago

At this time, the root cause (and fix) is to accept the consents in the official app

I logged out and back in to the MyCupra app, there was no consent questions.

my HA integration is still broken (about 3 weeks now), with the "Could not fetch data. Status Code was: 400". Logger: weconnect_cupra Source: /usr/local/lib/python3.12/site-packages/weconnect_cupra/api/cupra/api.py:74

I also see a status 429 , so, looking at https://github.com/daernsinstantfortress/cupra_we_connect/issues/81 increased the timeout to 60 seconds.

A website is also mentioned above, that one should login to also, what is the website address, is it https://seatid.vwgroup.io/account There I see just a few marketing options:

image

I also de-installed the integration and readded via HACS. File are in custom_components/cupra_we_connect as expected.

image

Have I missed something?

12retord commented 2 months ago

@daernsinstantfortress Is it possible, that the reason for this error in my case is, that I‘ve got a Hybrid (Tarraco) in the mycupra app? https://github.com/daernsinstantfortress/WeConnect-Cupra-python/pull/13

sijmenvos commented 1 month ago

I logged into https://seatid.vwgroup.io/account and afterwards I was able to login with the integration again.