flobz / psa_car_controller

Control psa car with connected_car v4 API.
GNU General Public License v3.0
403 stars 210 forks source link

RateLimitException #370

Closed stephankessler closed 2 years ago

stephankessler commented 2 years ago

Describe the bug When i use charge control at some point RateLimitExceptions are thrown, and i am not able to control the charge anymore. Additionally, the MyPeugeot App is also unable to retrieve the charging state.

Logs output are:

2022-05-23 23:50:21,549 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AP-ACNT200007356020/VehCharge/state/ProcessManagement b'{"process_date":"2022-05-23T21:50:21Z","vin":"MYVIN","correlation_id":"9e5c9035db8b456e9fede2ef085ad94420220523215021119","process_code":"901","process_message":"[process.901.vehicle.asleep.key]"}'
2022-05-23 23:51:29,554 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AP-ACNT200007356020/VehCharge/state b'{"resp_date":"2022-05-23T21:51:29Z","vin":"MYVIN","correlation_id":"9e5c9035db8b456e9fede2ef085ad94420220523215021119","return_code":"300"}'
2022-05-23 23:51:29,555 :: ERROR :: 300 : ?
2022-05-23 23:52:21,191 :: INFO :: charging status of MYVIN is InProgress, battery level: 49
2022-05-23 23:52:21,191 :: 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
2022-05-23 23:54:21,261 :: INFO :: charging status of MYVIN is InProgress, battery level: 49
2022-05-23 23:54:21,262 :: 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
2022-05-23 23:56:21,279 :: INFO :: charging status of MYVIN is InProgress, battery level: 49
2022-05-23 23:56:21,281 :: 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)

To Reproduce Still hard to find a way to reproduce this, it appears and disappear - maybe i must not use the mypeugeot app in parallel?

Config file

{
    "abrp": {
        "abrp_enable_vin": [
            "MYVIN"
        ],
        "token": "MYTOKEN"
    },
    "client_id": "ID",
    "client_secret": "SECRET",
    "co2_signal_api": null,
    "country_code": "DE",
    "customer_id": "AP-ACNT12345677",
    "proxies": {
        "http": "",
        "https": ""
    },
    "realm": "clientsB2CPeugeot",
    "refresh_token": "TOKEN",
    "remote_refresh_token": "TOKEN",
    "weather_api": null
}

Environment (please complete the following information): Docker Container Running latest (3.0.3) on Ubuntu.

stephankessler commented 2 years ago

And btw: great great software thanks so much! Also happy to fix the bug and submit a PR if we could narrow that down!

Thanks so much!

flobz commented 2 years ago

The rateLimit is used to limit the number of remote action in a period. Do you use the API of PSACC ?

stephankessler commented 2 years ago

Good Morning,

Besides using it via the Webbrowser to access information I am not using any more features of PSACC. I use the MyPeugeot app, but I would assume that this does not interfere with PSACC?

Best, Stephan

flobz commented 2 years ago

did you change anything regarding option of the addons ?

sebcorse commented 2 years ago

Hello Same issue on native linux Ubuntu 20 Same result with a new fresh install

[Solved] For me, issue was caused by last car update, which disable by default "data sharing" Thanks you to Peugeot devs ....