daernsinstantfortress / cupra_we_connect

Cupra integration for Home Assistant
Apache License 2.0
44 stars 4 forks source link

Unexpected error when attempting to log in on v0.8.2 #62

Closed martenjacobs closed 1 month ago

martenjacobs commented 2 months ago

I'm getting an unexpected error when attempting to log in:

image

I've seen suggestions to install 0.8.2 on similar questions, but I'm already there:

image

Here's the relevant log:

Logger: custom_components.cupra_we_connect.config_flow
Bron: custom_components/cupra_we_connect/config_flow.py:75
integratie: Cupra WeConnect (documentatie, problemen)
Eerst voorgekomen: 22:13:05 (3 gebeurtenissen)
Laatst gelogd: 22:17:21

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
Yorkie71 commented 2 months ago

I'm getting the same here. It was fine this morning so I suspect it's an API issue on the CUPRA side. The Ohme integration is paying up too.

Let's see if it rectifies itself.

beewhale commented 2 months ago

I also have this issue

chrisrock1984 commented 2 months ago

same for me

logs: 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: 6:32:57 AM (1 occurrences) Last logged: 6:32:57 AM

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

sk2andy commented 2 months ago

the python package seatconnect still works for my Cupra Leon. So I guess that's rather an issue with the home assistant integration instead of a general issue with the API.

Yorkie71 commented 2 months ago

I'm pretty sure that other than the URL change made the other week, nothing has changed from the integration side.

daernsinstantfortress commented 2 months ago

Yup, Cupra have changed something and the library is dead. I'll try to take a look when I can, but it will be a little while as I'm stacked at the moment.

Yorkie71 commented 2 months ago

No rush @daernsinstantfortress appreciate the support. I have also taken this up separately with CUPRA and am waiting for a response.

BjoernWaechter commented 2 months ago

I did some debugging and found a redirect 303 and a Location header looking like this:

https://identity.vwgroup.io/signin-service/v1/3c756d46-xxxx-xxxx-xyxx-cff0d5292dxx@apps_vw-dilab_com/terms-and-conditions?relayState=db9dxxxxxxxxxx56d46c4da97ae2aa189126ea52&canChangeCountryOfResidence=true

I tried to open the the URL in a normal browser which showed "Nutzungsbedingungen" / terms and conditions which I had to accept to login. After accepting everthing works now as usual.

Intenos commented 2 months ago

Great job @BjoernWaechter !

It worked for me as well. You can just go to https://cupraid.vwgroup.io/account log in with your credentials and confirm the terms of use.

Thanks a lot!

aperezva commented 2 months ago

It´s not working in my case

xLexip commented 2 months ago

Nice @BjoernWaechter, works for me as well. I don't think this can be fixed by the integration. Users have to accept it themselves...

I don't understand why this prompt does not show up in the cupra app. I they've updates the T&C, everyone would have to accept it and if not, then this is pointless.

aperezva commented 2 months ago

I have accepted and it´s not working

Intenos commented 2 months ago

@aperezva : I restarted also the integration in Home Assistant. Forgot to mention that.

aperezva commented 2 months ago

I have restarted. reinstalled and it´s not working.

Well tomorrow i will try again

lone-baggie commented 2 months ago

All working . 👍

Yorkie71 commented 2 months ago

Hi @BjoernWaechter thanks for sharing. This worked perfectly. Excellent troubleshooting!

When I went to the MyCUPRA site I had to accept about four T&C statements so they must have updated this recently.

At least it's working now and should be OK from now.

kallejoken commented 2 months ago

Thanks for the workaround, everything is working as usual again now!

aperezva commented 2 months ago

Gavina The same error since yesteday. I accept conditions, reinstalled, reboot.

But the same error

IMG_1196

Gi7mo commented 1 month ago

I had the same error accepting the wall of toc, as mentioned by @BjoernWaechter , also helped me

Yorkie71 commented 1 month ago

I had the same error accepting the wall of toc, as mentioned by @BjoernWaechter , also helped me

"The Wall of ToC". Made me laugh but yes, you are right. There were a few click thru pages there. Goodness knows what I have agreed to but at least my HA integration is working now. I would have really missed my zone triggered climate control activation and the automation to stop my car draining the home battery when Octopus decide to schedule an ad-hoc charge is critical to a continued good relationship with my wife as waking up to an empty home battery is not a good start to the day! 🤣

Yorkie71 commented 1 month ago

@aperezva I'd try logging into your CUPRA ID account again if I were you. It seems to have worked for me and other here so I suspect you might have missed one of the T&C clicks; there were a few of them! Good luck.

xLexip commented 1 month ago

Gavina The same error since yesteday. I accept conditions, reinstalled, reboot.

But the same error

What do the logs say?

aperezva commented 1 month ago

Tried again

Same error

my logs: 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

daernsinstantfortress commented 1 month ago

Yes, mine also worked after stepping through the new consents on the official app.

I had to log out of the app completely (there is a button in there somewhere!) and then log back in, and click through a stack of consents before returning to the app home screen. Once done, the library returned to function again.

aperezva commented 1 month ago

No way to me.

The same logout , log in etc

Hoping someone help me

@daernsinstantfortress

roelzadh commented 1 month ago

It would be nice to link the toc when installing the addon. Accepting the terms fixed the issue here aswell. Also for the Eneco smartcharing app :-)

aperezva commented 1 month ago

Yes, mine also worked after stepping through the new consents on the official app.

I had to log out of the app completely (there is a button in there somewhere!) and then log back in, and click through a stack of consents before returning to the app home screen. Once done, the library returned to function again.

Which library?

daydy16 commented 1 month ago

Yes, mine also worked after stepping through the new consents on the official app.

I had to log out of the app completely (there is a button in there somewhere!) and then log back in, and click through a stack of consents before returning to the app home screen. Once done, the library returned to function again.

Oh wow thanks, it really fixed it! After doing this the integration in ha works again

AlexZ1402 commented 1 month ago

Ja, bei mir hat es auch funktioniert, nachdem ich die neuen Zustimmungen in der offiziellen App durchgegangen bin.

Ich musste mich vollständig aus der App abmelden (da ist irgendwo ein Button!), mich dann wieder anmelden und mich durch einen Stapel Zustimmungen klicken, bevor ich zum Startbildschirm der App zurückkehrte. Danach funktionierte die Bibliothek wieder.

So it still doesn't work for me, but it works in EVCC and iobroker without any problems

daernsinstantfortress commented 1 month ago

So it still doesn't work for me, but it works in EVCC and iobroker without any problems

Did you definitely accept all of the consents in the official app? Has your error changed?

AlexZ1402 commented 1 month ago

So it still doesn't work for me, but it works in EVCC and iobroker without any problems

Did you definitely accept all of the consents in the official app? Has your error changed?

It has always worked in evcc and in iobroker, with this addon it worked once and then no longer until today, I logged out on the website as described, logged out in the app, accepted everything, the problem is definitely not that, but where otherwise it wouldn't work for everyone else ;) works for EVCC, iobroker, Openhab and also simple queries in the Linux terminal and all of that without having to accept anything or not

aperezva commented 1 month ago

Siempre ha funcionado en evcc y en iobroker, con este complemento funcionó una vez y luego ya no hasta hoy, cerré la sesión en el sitio web como se describe, cerré la sesión en la aplicación, acepté todo, el problema definitivamente no es ese, pero de lo contrario no funcionaría para todos los demás ;) funciona para EVCC, iobroker, Openhab y también consultas simples en la terminal Linux y todo eso sin tener que aceptar nada o no

Definetily is a integration problem, maybe forced for a change in Cupra site, but to my it´s not working. Trying another alternatives.

Can I use EVCC in home assitant?

AlexZ1402 commented 1 month ago

Siempre ha funcionado en evcc y en iobroker, con este complemento funcionó una vez y luego ya no hasta hoy, cerré la sesión en el sitio web como se describe, cerré la sesión en la aplicación, acepté todo, el problema definitivamente no es ese, pero de lo contrario no funcionaría para todos los demás ;) funciona para EVCC, iobroker, Openhab y también consultas simples en la terminal Linux y todo eso sin tener que aceptar nada o no

Definetily is a integration problem, maybe forced for a change in Cupra site, but to my it´s not working. Trying another alternatives.

Can I use EVCC in home assitant?

HACS https://github.com/evcc-io/hassio-addon

yes, I suspect there have been big changes at Seat There used to be an extra seat extra cupra app Now there is Cupra app and Seat app and both are 100% identical, I can access my vehicles in both / Cupra Born and Seat Hybrid

AlexZ1402 commented 1 month ago

Here is a screenshot from evcc, it retrieves all data online, here is an example of Seat and Cupra also works without any problems Screenshot 2024-06-28 162708 Screenshot 2024-06-28 162927

Intenos commented 1 month ago

@aperezva @AlexZ1402 Have you installed the latest Version 0.8.2 of the integration?

AlexZ1402 commented 1 month ago

@aperezva @AlexZ1402 Have you installed the latest Version 0.8.2 of the integration?

I have had integration for about 4 months, always the latest version / automatic update. But I have also installed and tested older versions, without success.

aperezva commented 1 month ago

@aperezva @AlexZ1402 Have you installed the latest Version 0.8.2 of the integration?

yes, weeks ago.

I think it s a problme regarding terms acceptation, I don´t know if i can remove myh user from Cupra app and generated again , maybe with another user.

My fear is that something block my vehicle and in this case nothing works even the app

AlexZ1402 commented 1 month ago

I don't think the problem is with the "terms acceptance" because, as mentioned above, it works without any problems with EVCC and iobroker

aperezva commented 1 month ago

see in EVCC

"creating vehicle my_car failed: cannot create vehicle type 'template': cannot create vehicle type 'cupra': terms of service updated- please open app or website and confirm"

And also I have changed my user to another user and asociated again the vehicle, reseting the car. Enought for today

AlexZ1402 commented 1 month ago

see in EVCC

"creating vehicle my_car failed: cannot create vehicle type 'template': cannot create vehicle type 'cupra': terms of service updated- please open app or website and confirm"

And also I have changed my user to another user and asociated again the vehicle, reseting the car. Enought for today

vehicles:

Cupra Born

dazzyp commented 1 month ago

Great job @BjoernWaechter !

It worked for me as well. You can just go to https://cupraid.vwgroup.io/account log in with your credentials and confirm the terms of use.

Thanks a lot!

Thanks @BjoernWaechter and @Intenos ... I've got my Cupra intregration working again by 1) deleting my credentials in the HA Cupra Weconnect intergration 2) Logging into the (https://cupraid.vwgroup.io/account) URL stated above in my browser 3) Logging in with my usual cupra ID and accepting all 4 of the T&C prompts 4) Going back to HA and repeating the cupra login in the intergration. i didn't restart HA at all..

All my Cupra entities reappeared and all my dashboard entries and cupra automations are working again.

Thank you so much!

darren

aperezva commented 1 month ago

Having the same problem

Este error se originó a partir de una integración personalizada.

Registrador: custom_components.cupra_we_connect.config_flow Fuente: custom_components/cupra_we_connect/config_flow.py:75 integración: cupra_we_connect (documentación, problemas) Ocurrió por primera vez: 13:00:49 (1 ocurrencias) Último inicio de sesión: 13:00:49

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

@BjoernWaechter do you have any idea how to solved.

I have:

deleted mi user reinstalled integration Changed user reset my car and still doesn´t work.

I appreciate much more your help

Thanks

aperezva commented 1 month ago

Still not working. I don’t know what to try.

It s clear that CUPRA wait for my acceptance in terms but I have already done several times.

BjoernWaechter commented 1 month ago

@aperezva I would try to install the we_connect_cupra package like described here: https://pypi.org/project/weconnect-cupra-daern/ I than used this example for my tests: https://github.com/daernsinstantfortress/WeConnect-Cupra-python/blob/main/examples/access_status.py I found the redirect header to the terms and conditions site in my_cupra_session.py line 172 In login3Response.headers I saw the a location header with the mentioned path. Can you check what you get there?

aperezva commented 1 month ago

I m sorry but i don´t know how and where installa this python program?. In home assitant directly? In a debian server? BR and thanks

aperezva commented 1 month ago

Nobody knows if i have to fix any line ?.

BjoernWaechter commented 1 month ago

I m sorry but i don´t know how and where installa this python program?. In home assitant directly? In a debian server? BR and thanks

Not in home assistant. On a machine with python installed. Ubuntu sounds good.

aperezva commented 1 month ago

thanks i ll try

RockingBurn commented 1 month ago

@aperezva perhaps try another browser and also deactivate all ad-blockers

aperezva commented 1 month ago

I give up.

Thanks a lot, I will come back maybe when cupra ask me for new terms, Now imposible and in EVVC I have the same problem, That´s why I guess is a problem with mi VN car, because I changed several times my user and added a new one.

I dont´want to disturb you more than necessary