psa_car_controller
psa_car_controller copied to clipboard
Cannot get remote refresh token error
Error : 2024-04-15 11:02:36,058 :: ERROR :: Can't refresh remote token 'refresh_token' Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 167, in _refresh_remote_token self.remoteCredentials.refresh_token = data["refresh_token"] KeyError: 'refresh_token'
Platform: home assistant.
I tried to redo the authentication with --web-conf and once I did the authentication, I tried to restart the ad-on with -f config.json -c charge_config.json -r parameter gives me this error.
Sometimes, restarting the homeassistant fixes this issue sometimes not.
Same issue here! I run it a separate app.
Looks like a PSA Server issue, I also got the message including rate limit exceeded, but I didn't forced updates or something like that. Since a 15 minutes the servers are working fine again.
Same error too here. Can't auth now
2024-04-16 07:58:34,646 :: INFO ::
Your vehicles: ["{'vin': 'VRXXXXXXXXXXXXXX', 'vehicle_id': '111b60eb6155acb9971053634c735ec544ae85eb52665b2e1cc60909a7f1979616ad01d7e531038903ac44b41db3cee3738756cb51a493176325fe32d03e19feff5ce9850cf4013eaec48ee2a234f0a9cb69f8f13366a418ac6ba6552', 'label': 'e-208', 'brand': 'Peugeot', 'abrp_name': 'peugeot:e208:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
2024-04-16 07:58:34,647 :: INFO :: save config change
2024-04-16 07:58:34,647 :: INFO :: App version 3.5.0
2024-04-16 07:58:34,649 :: ERROR :: finish_oauth:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/config_oauth.py", line 56, in finish_oauth
config_views.INITIAL_SETUP.connect(code)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 134, in connect
app.load_app()
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/car_controller.py", line 102, in load_app
self.is_good = self.myp.manager.refresh_token_now()
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/common/utils.py", line 23, in wrapper
raise RateLimitException
psa_car_controller.common.utils.RateLimitException
2024-04-16 07:58:34,649 :: INFO :: 172.30.32.1 - - [16/Apr/2024 07:58:34] "POST /_dash-update-component HTTP/1.1" 200 -
more log for debug maybe... Retry new setup connection 12:03
2024-04-16 12:03:16,490 :: INFO :: Initial setup...
2024-04-16 12:03:22,891 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:03:22] "POST /_dash-update-component HTTP/1.1" 200 -
2024-04-16 12:03:24,881 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:03:24] "GET /config_connect?url=https://idpcvs.peugeot.com/am/oauth2/authorize?client_id%3D1eebc2d5-5df3-459b-a624-20abfcf82530%26redirect_uri%3Dmymap%253A%252F%252Foauth2redirect%252Ffr%26response_type%3Dcode%26scope%3Dopenid%2520profile%26state%3DoZbpnr6wvgBNktls_0WMOg%26code_challenge%3DfFinxenXcmrtXPpCloW82MtkwDXPbHdyKcnIVk1oDIU%26code_challenge_method%3DS256 HTTP/1.1" 200 -
2024-04-16 12:03:25,069 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:03:25] "GET /_dash-layout HTTP/1.1" 200 -
2024-04-16 12:03:25,070 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:03:25] "GET /_dash-dependencies HTTP/1.1" 200 -
2024-04-16 12:03:25,105 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:03:25] "POST /_dash-update-component HTTP/1.1" 200 -
2024-04-16 12:03:25,138 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:03:25] "POST /_dash-update-component HTTP/1.1" 204 -
2024-04-16 12:04:00,295 :: ERROR :: Exception on /get_vehicleinfo/VRXXXXXXXXXXXXXX [GET]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/lib/python3/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/api.py", line 48, in get_vehicle_info
response=json.dumps(APP.myp.get_vehicle_info(vin, from_cache).to_dict(), default=str),
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/psa_client.py", line 107, in get_vehicle_info
res = self.api().get_vehicle_status(car.vehicle_id)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status
(data) = self.get_vehicle_status_with_http_info(id, **kwargs) # noqa: E501
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info
return self.api_client.call_api(
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/oauth.py", line 107, in call_api
return self._ApiClient__call_api(resource_path, method,
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 147, in __call_api
self.update_params_for_auth(header_params, query_params, auth_settings)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 504, in update_params_for_auth
auth_setting = self.configuration.auth_settings().get(auth)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/configuration.py", line 241, in auth_settings
'value': 'Bearer ' + self.access_token
TypeError: can only concatenate str (not "NoneType") to str
2024-04-16 12:04:00,296 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:04:00] "GET /get_vehicleinfo/VRXXXXXXXXXXXXXX?from_cache=1 HTTP/1.1" 500 -
2024-04-16 12:04:00,296 :: INFO :: <Request 'http://localhost:5000/charge_control?vin=VRXXXXXXXXXXXXXX' [GET]>
2024-04-16 12:04:00,297 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:04:00] "GET /charge_control?vin=VRXXXXXXXXXXXXXX HTTP/1.1" 200 -
2024-04-16 12:04:00,301 :: INFO :: 172.30.32.1 - - [16/Apr/2024 12:04:00] "GET /battery/soh/VRXXXXXXXXXXXXXX HTTP/1.1" 200 -
2024-04-16 12:04:09,431 :: INFO :: save config change
2024-04-16 12:04:09,798 :: INFO ::
Your vehicles: ["{'vin': 'VRXXXXXXXXXXXXXX', 'vehicle_id': '111eb6155acb9971053634c7351544ae85eb52665b2e1cc69a7f1979616ad01d7e531038ed903ac44b41db3cee8756cb51a493176325fe32d09fefff5ce9850cf4013eaec4f8ee2a234f0b69f8f13366a418ac6ba326552', 'label': 'e-208', 'brand': 'Peugeot', 'abrp_name': 'peugeot:e208:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
2024-04-16 12:04:09,799 :: INFO :: save config change
2024-04-16 12:04:09,799 :: INFO :: App version 3.5.0
2024-04-16 12:04:10,445 :: INFO :: ["{'vin': 'VRXXXXXXXXXXXXXX', 'vehicle_id': '111eb6155acb9971053634c7351544ae85eb52665b2e1cc69a7f1979616ad01d7e531038ed903ac44b41db3cee8756cb51a493176325fe32d09fefff5ce9850cf4013eaec4f8ee2a234f0b69f8f13366a418ac6ba326552', 'label': 'e-208', 'brand': 'Peugeot', 'abrp_name': 'peugeot:e208:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
2024-04-16 12:04:10,773 :: ERROR :: remote_refresh_token isn't defined
2024-04-16 12:04:11,170 :: ERROR :: Error during activation: {'err': 'NOK:FORBIDDEN'}
2024-04-16 12:04:11,429 :: ERROR :: Can't refresh remote token 'access_token'
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 174, in _refresh_remote_token
self._get_remote_access_token(otp_code)
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 206, in _get_remote_access_token
self.remoteCredentials.access_token = data["access_token"]
KeyError: 'access_token'
2024-04-16 12:04:15,597 :: INFO :: save config change
After multiple retries I managed to run the ad-on, but this is what happens when i try to wakeup using rest command
2024-04-16 13:26:15,920 :: INFO :: ask wakeup to VR3UKZKXmmmmm
2024-04-16 13:26:15,922 :: INFO :: topic: psa/RemoteServices/from/cid/AP-ACNT200008710854/VehCharge/state: {'action': 'state'}
2024-04-16 13:26:16,995 :: ERROR :: Can't refresh remote token 'refresh_token'
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 167, in _refresh_remote_token
self.remoteCredentials.refresh_token = data["refresh_token"]
KeyError: 'refresh_token'
2024-04-16 13:26:34,655 :: INFO :: save config change
After this the adon crashed. Issue persists after restart of home assistant. did redo the authentication, but still not able to start the ad-on without multiple retries. Issue started from yesterday
Also experiencing the same issue since this weekend. It retrieves data just fine, but I am unable to start the pre-condtioning or do a wakeup call for example. Getting the same errors as everyone else ^^
charging status of VIN is InProgress, battery level: 31
2024-04-16 15:49:02,106 :: 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 23, in wrapper
raise RateLimitException
psa_car_controller.common.utils.RateLimitException
ask wakeup to VIN
2024-04-16 15:37:02,185 :: INFO :: topic: psa/RemoteServices/from/cid/AP-XXXXXX/VehCharge/state: {'action': 'state'}
2024-04-16 15:37:02,185 :: 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 155, in _refresh_remote_token
self.manager.refresh_token_now()
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/common/utils.py", line 23, in wrapper
raise RateLimitException
psa_car_controller.common.utils.RateLimitException
I also tried to re-authenticate this weekend, when entering the GUID from the oauth redirect, the loading bar kept spinning forever after clicking the Submit button in the webapp
Now control shows this.
And all my entities in HA is unavailable now !!
Please someone help me fix this
I Also have the exact same issue: 2024-04-16 17:21:47,641 :: ERROR :: Error during activation: {'newversion': None, 'newversionurl': None, 'err': 'NOK:MAXNBTOOLS'} 2024-04-16 17:21:48,332 :: ERROR :: remote_refresh_token isn't defined 2024-04-16 17:21:48,771 :: ERROR :: Error during activation: {'err': 'NOK:FORBIDDEN'} 2024-04-16 17:21:50,406 :: ERROR :: Can't refresh remote token 'access_token' Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 174, in _refresh_remote_token self._get_remote_access_token(otp_code) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 206, in _get_remote_access_token self.remoteCredentials.access_token = data["access_token"] KeyError: 'access_token'
Started with the info not being available in Home Assistant. Restarted the docker container. And saw the token wasn't valid anymore. When trying to Re-activat.. The above error occurs
I Also have the exact same issue: 2024-04-16 17:21:47,641 :: ERROR :: Error during activation: {'newversion': None, 'newversionurl': None, 'err': 'NOK:MAXNBTOOLS'} 2024-04-16 17:21:48,332 :: ERROR :: remote_refresh_token isn't defined 2024-04-16 17:21:48,771 :: ERROR :: Error during activation: {'err': 'NOK:FORBIDDEN'} 2024-04-16 17:21:50,406 :: ERROR :: Can't refresh remote token 'access_token' Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 174, in _refresh_remote_token self._get_remote_access_token(otp_code) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 206, in _get_remote_access_token self.remoteCredentials.access_token = data["access_token"] KeyError: 'access_token'
Started with the info not being available in Home Assistant. Restarted the docker container. And saw the token wasn't valid anymore. When trying to Re-activat.. The above error occurs
Since you are getting {'err': 'NOK:FORBIDDEN'} error, I think you exceeded the limit of sms activations set by the psa server. To fix this, install mypeugeot app from the play/apple store ( uninstall and reinstall if already installed ), login then try to turn on the climate control. The app now ask you to reset your pin and send sms. once you do this, this error will be fixed.
This is explained here https://github.com/flobz/psa_car_controller/blob/master/FAQ.md#2-error-during-activation-newversion-200-newversionurl-httpminwebocom-err-nokforbidden
Datas are retrieving now after multple reinstallations and tries but no remote commands are working
2024-04-17 10:12:37,847 :: INFO :: Preconditioning: topic: psa/RemoteServices/from/cid/AP-ACNT20000871xxx4/ThermalPrecond: {'asap': 'activate', 'programs': {'program1': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program2': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program3': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program4': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}}}
2024-04-17 10:12:38,652 :: ERROR :: Can't refresh remote token 'refresh_token'
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 167, in _refresh_remote_token
self.remoteCredentials.refresh_token = data["refresh_token"]
KeyError: 'refresh_token'
2024-04-17 10:12:56,886 :: INFO :: save config change
This is what happens with a climate control call
same issue with app (docker) and /or HA add-on
2024-04-17 11:14:30,858 :: WARNING :: Disconnected with result code 1 2024-04-17 11:14:31,354 :: ERROR :: Can't refresh remote token 'refresh_token' Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 167, in _refresh_remote_token self.remoteCredentials.refresh_token = data["refresh_token"] KeyError: 'refresh_token' 2024-04-17 11:14:32,192 :: INFO :: save config change
Peugeot app is also unable to retrieve current data, so it looks like the PSA server issues. But the psacc app could certainly do better when handling the error, by not crashing 🙂
Official app also cannot do the preconditioning but other datas are updating properly
The myOpel App is working fine, including precondition, data sync of SOC etc.
same issue with app (docker) and /or HA add-on
2024-04-17 11:14:30,858 :: WARNING :: Disconnected with result code 1 2024-04-17 11:14:31,354 :: ERROR :: Can't refresh remote token 'refresh_token' Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 167, in _refresh_remote_token self.remoteCredentials.refresh_token = data["refresh_token"] KeyError: 'refresh_token' 2024-04-17 11:14:32,192 :: INFO :: save config change
+1 same to me I think for two days..
Can't refresh token anymore and no commands work. Has been like this for a couple of days. Otp config not responding either.
I think, MyPeugeot app hit the same rate limit exception as psacc in my case.
I can now confirm that my peugeot app works just fine from today morning. I can refresh soc while charging, and it updates properly. Climate control also works fine. But same issue with psacc unfortunately. No luck so far with remote commands like wake up or climate control or stop/start charge
I have exactly the same issue with each remote command to a e208 with this common result:
Create a new one
2024-04-18 09:11:18,022 :: 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 23, in wrapper
raise RateLimitException
psa_car_controller.common.utils.RateLimitException
Update again: Mypeugeot app stopped responding again !! Such dumb servers !!
Had the same issue yesterday :
- No update during the AC charging session (psacc and Peugeot app)
- I could stop the charge from the Peugeot app
- Stopping the charge from the time set did not work, can't refresh remote token error.
It looks like the same behaviour from a few weeks ago. I wonder if the SoC update is working during a DC charge, could be interesting to know
Just want to add just in case. I was seeing the error couple days ago as well but it has gone away since yesterday... I still received position, SOC data, etc throughout.
I just tried preconditioning and that triggers the Refresh token error.
2024-04-18 21:12:32,563 :: INFO :: Preconditioning: topic: psa/RemoteServices/from/cid/AP-ACNT200008553362/ThermalPrecond: {'asap': 'activate', 'programs': {'program1': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program2': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program3': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program4': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}}}
2024-04-18 21:12:33,244 :: ERROR :: can't refresh_remote_token: {'error_description': 'grant is invalid', 'error': 'invalid_grant'}
Create a new one
2024-04-18 21:12:35,093 :: INFO :: save config change
Just want to add just in case. I was seeing the error couple days ago as well but it has gone away since yesterday... I still received position, SOC data, etc throughout.
I just tried preconditioning and that triggers the Refresh token error.
2024-04-18 21:12:32,563 :: INFO :: Preconditioning: topic: psa/RemoteServices/from/cid/AP-ACNT200008553362/ThermalPrecond: {'asap': 'activate', 'programs': {'program1': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program2': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program3': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}, 'program4': {'day': [0, 0, 0, 0, 0, 0, 0], 'hour': 34, 'minute': 7, 'on': 0}}} 2024-04-18 21:12:33,244 :: ERROR :: can't refresh_remote_token: {'error_description': 'grant is invalid', 'error': 'invalid_grant'} Create a new one 2024-04-18 21:12:35,093 :: INFO :: save config change
Data is indeed still being received but all actions from this app to the Peugeot servers are giving the token error
I still get the data as well. It updates odometer, battery level and everything during trip and other times. The issue is we cannot manually force a remote command like precondition or wakeup call which will give this error. The battery level is not updating during charging. I have to manually go to car and unlock it to get the data in the app. So obviously charge control won't work.
I have the same 'can't refresh_remote_token' problem. But also the myOpel smartphone app isn't able to wakeup and get more actual values. It presents old values when forcing to refresh.
MyPeugeot app works now, but still issue persists with psacc
Now my battery is at 100% and I will sit here till tomorrow on it. This is frustrating.
Could it be related to this topic : https://github.com/flobz/psa_car_controller/discussions/700 ?
If the app is working but the controller is not, that could be the reason.
The App is "working", pull down to update on the charging page isn't working. Changing the precondition and sync it, is working in the app, sometimes the app updates the charging status after all and updates it every 20 minutes and after charging is finished. But definitely not smooth like a week before