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

Access token issue #576

Closed
SentiHassio1979 opened this issue Jul 1, 2023 · 20 comments
Closed

Access token issue #576

SentiHassio1979 opened this issue Jul 1, 2023 · 20 comments

Comments

@SentiHassio1979
Copy link

Hi,

After a restore I can't connect anymore with the user config, after submit I get the following response. If I misstype the password it gives a different code. What can I do?

Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 48, in firstLaunchConfig token = res.json()["accessToken"] KeyError: 'accessToken' HOST_BRANDID : https://id-dcr.opel.com/mobile-services sitecode: OP_NL_ESP{"session":"f67d813ff9ce67fb504796e20e18328b","returnCode":"NEED_AUTHORIZATION","token":"0188a165ff0067306880e7a77963e0deb87a77f804b8f686af1508ff5623faeb","fields":{"USR_PASSWORD":"SETPWD_LABEL_8"}}

@europeke
Copy link

europeke commented Jul 1, 2023

Same issue Peugeot, correct user/pw, does not work.

@cascer1
Copy link
Contributor

cascer1 commented Jul 10, 2023

I am also getting this issue on current and old versions. Something about a wrong grant in the error message

ERROR :: can't refresh_remote_token: {'error_description': 'grant is invalid', 'error': 'invalid_grant', 'refresh_token': 'redacted'}

@flix-one
Copy link

Since today I'm also getting errors, first OTP errors. After removing and re-installing the addon, that was gone.
But after the OTP error, I get another error:

Attribute Error: 'PSACarController' object has no attribute 'chc'

and the GET task for /charge_control gets an Error 500 answer

@MikeRow1972
Copy link

Same problem here after a VM Restor. Same on a fresh install

ConfigException
psa_car_controller.psa.otp.otp.ConfigException: Can't get otp code

Traceback (most recent call last)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 193, in get_otp_code
otp_code = self.otp.get_otp_code()
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/otp/otp.py", line 276, in get_otp_code
raise ConfigException("Can't get otp code")
During handling of the above exception, another exception occurred:
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/views.py", line 183, in wakeup
return jsonify(APP.myp.remote_client.wakeup(vin))
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/common/utils.py", line 16, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 230, in wakeup
self.publish(msg)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 138, in publish
self._refresh_remote_token()
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 173, in _refresh_remote_token
otp_code = self.get_otp_code()
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/common/utils.py", line 16, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 197, in get_otp_code
otp_code = self.otp.get_otp_code()
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/otp/otp.py", line 276, in get_otp_code
raise ConfigException("Can't get otp code")
psa_car_controller.psa.otp.otp.ConfigException: Can't get otp code

@flix-one
Copy link

flix-one commented Jul 10, 2023

Yes thats the same error I'm getting every time I'm restarting the addon. Then I have to re-do the OTP process with SMS verification. After that I get the Attribute Error stated above.

@maximumstruggle
Copy link

Hello, I get the same error since the end of the last week as well

@cascer1
Copy link
Contributor

cascer1 commented Jul 11, 2023

The Opel Connect app is also having intermittent issues (claiming I don't have permission to view my own car). Perhaps there's something going on at their side?

@maximumstruggle
Copy link

The Opel Connect app is also having intermittent issues (claiming I don't have permission to view my own car). Perhaps there's something going on at their side?

Same here with the Peugeot App. Didn't try to charge since Saturday but the error message didn't appear in the app since then

@maximumstruggle
Copy link

Did another test this morning : I plugged the car in and the error message stating I don't have the permisions to manage the car only appear when I go to the Charge menu and after asking me to enter the Pin Code. same error when trying it from the wife's phone. Looks like something definitely on their side. I have opened an issue ticket.

@flix-one
Copy link

Of course something changed on the side of Stellantis, the PSA Car Controller is only fetching data from their cloud.

The question is: Is It a bug on the Stellantis side or a change in their API, and the Car Controller addon needs a Code Change?

@flobz: Could you have a look into this issue?

@SentiHassio1979
Copy link
Author

Mine is working again since this weekend. I do remember the PSA app not liking a certain number of incorrect logins. You don't get a clear message on that issue at those moments. So could be good to update password / passcode in original app before trying again in home assistant.

@MikeRow1972
Copy link

The error only appeared for me after a service restart. A new installation on a test server also shows the problem. Account is not locked due to incorrect logins. The Opel app on the phone has also been updating very poorly for a few days

@MikeRow1972
Copy link

Today i try the user/otp setup again on 2 Test Machines. Both machines now receiving data, but i see the Battery SOC on both machines and opel app gives same old data (100%)

@maximumstruggle
Copy link

Did another test this morning : I plugged the car in and the error message stating I don't have the permisions to manage the car only appear when I go to the Charge menu and after asking me to enter the Pin Code. same error when trying it from the wife's phone. Looks like something definitely on their side. I have opened an issue ticket.

Peugeot Customer Service called me this afternoon. Their reason for the official app behaviour is "Your car is involved in a recall campaign, once your car software will be updated, the issue will be resolved".

I don't know much but I highly doubt this is the reason behind this error.

@cascer1
Copy link
Contributor

cascer1 commented Jul 13, 2023

I got a similar message from tech support. Checking our national car registry (https://ovi.rdw.nl/#) did reveal an active recall that Opel never bothered to mail me about. We'll see if the issue is resolved after the recall is finally taken care of in two months 😒

@maximumstruggle
Copy link

Two months ? That's really bad. The update is scheduled for August 9th for me. We have to do two 400km trip without the possibility to check the SoC with the app while it's charging on a SuC. It's going to be fun on chargers without the SoC displayed =)

@maximumstruggle
Copy link

The car has been charging for 30 min now and the isue seems resolved : the battery level is correctly updating in psa_car_controller and the Peugeot app doesn't prompt me for my PIN code anymore. Also, SoC is correctly updating in the Peugeot app.

@flix-one
Copy link

For my Opel, unfortunately there is no improvement.
I still get the AttributeError: 'PSACarController' object has no attribute 'chc'
Did you change something in your installation @maximumstruggle ?

@maximumstruggle
Copy link

I didn't change anything. However, after charging for a while I still see some issues :

  • Peugeot App still working, no issue
  • psa_car_controller : update of the battery level is working for a moment after updating the battery status from the Peugeot App :
2023-07-19 15:12:29,067 :: INFO :: charge_now: topic: psa/RemoteServices/from/cid/hiding_this/VehCharge: {'program': {'hour': 0, 'minute': 55}, 'type': 'delayed'}
2023-07-19 15:13:27,134 :: INFO :: new position recorded for *MY_VIN*
2023-07-19 15:13:27,175 :: INFO :: update_data
2023-07-19 15:13:29,788 :: INFO :: charging status of VR3UHZKXZNT110011 is InProgress, battery level: 81
2023-07-19 15:13:29,789 :: INFO :: charging status of VR3UHZKXZNT110011 is InProgress, battery level: 81
2023-07-19 15:13:29,790 :: INFO :: charging status of VR3UHZKXZNT110011 is InProgress, battery level: 81
2023-07-19 15:13:29,791 :: INFO :: charging status of VR3UHZKXZNT110011 is InProgress, battery level: 81

But after a while, battery level isn't updating anymore, and errors appears. The level displayed here is wrong since at this time it was above 82% (checked on Peugeot App) :

2023-07-19 15:26:26,182 :: ERROR :: force_update:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/charge_control.py", line 70, in force_update
    self.psacc.remote_client.wakeup(self.vin)
  File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/common/utils.py", line 22, in wrapper
    raise RateLimitException
psa_car_controller.common.utils.RateLimitException
2023-07-19 15:27:27,012 :: INFO :: charging status of MY_VIN is InProgress, battery level: 82
2023-07-19 15:27:27,013 :: INFO :: ask wakeup to MY_VIN
2023-07-19 15:27:27,014 :: INFO :: topic: psa/RemoteServices/from/cid/AP-ACNT200007545285/VehCharge/state: {'action': 'state'}
2023-07-19 15:27:27,295 :: ERROR :: remote_refresh_token isn't defined
2023-07-19 15:27:27,296 :: ERROR :: Can't refresh remote token 
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 173, in _refresh_remote_token
    otp_code = self.get_otp_code()
  File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/common/utils.py", line 22, in wrapper
    raise RateLimitException
psa_car_controller.common.utils.RateLimitException

If I update the battery level from the Peugeot App again, psa_car_controller will be also updated and so on. Maybe the recall thing will fix it, still have some doubt, but at least I can see my battery level from the Peugeot App again. I can't use psa_car_controller for the moment, that's it.

@maximumstruggle
Copy link

Did a new test today : Peugeot app is working fine and after a container reboot, psa_car_controller is updating the battery and stopping the charge at the set threshold.

@flobz flobz closed this as completed Oct 31, 2023
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

7 participants