psa_car_controller icon indicating copy to clipboard operation
psa_car_controller copied to clipboard

No update of values while charging

Open dnnrwttr opened this issue 10 months ago • 13 comments

Hi,

i dont get update of the values from the car when i charge the car. i always have to unlock and lock doors to get an update of datas (for example soc)... how can i fix that?!

Mokka-e, est. 2021

Regards Malte

dnnrwttr avatar Feb 11 '25 19:02 dnnrwttr

In most cases re-logging to PSACC solves the problem.

Edit: but at the moment it's most probably an issue on PSA server, as the official app doesn't update either.

Edit2: few days later PSACC died totally. I had to do a fresh install + login procedure to get it back running.

5kat3R avatar Feb 13 '25 17:02 5kat3R

I have the same issue after starting to charge I get errors in the logs:

2025-02-18 18:46:41,780 :: WARNING :: remote_refresh_token isn't defined 2025-02-18 18:46:42,155 :: ERROR :: Error during activation: {'err': 'NOK:FORBIDDEN'}

Once the charging is done, everything is working fine again.

TheRealSlimSchaali avatar Feb 18 '25 19:02 TheRealSlimSchaali

I get updates... But only if i lock and unlock the door of the car! While charging, i dont get any updates of the state for example...

dnnrwttr avatar Feb 21 '25 07:02 dnnrwttr

PSA add-on version : 3.5.3 PSA car model : ds4 e-tense

HA Core 2025.2.5 HA Supervisor 2025.02.4 HA Operating System 14.2 HA Frontend 20250221.0

Charging start is always well automaticaly detected by the add_on After start, the add-on seems expecting the charging_level to increase during charging. However, ss the battery_level remains constant during charging, the add-on repeatedly try to wake-up the server but every wake-up fails (FORBIDDEN) until charging end is detected Redoing otp procedure as suggested in the log has no effect...

Same sequence of errors occur during each charging of the car.

The add-on sqlite database is however always well updated for all chargings with goods start_date/start_level/end_date/end_level

NB: I created a HA rest_command "psa_get_live_info" (get_live_info without using cache) that make the corresponding HTTP request to the add_on. The call to the corresponding service (using ha/tools/actions frontend), always return with status OK (200) (no otp requirement) The content of the response also shows that the charging level never increase during charging.

#
##############################################
# rest_commands for PSACC API
##############################################
#
rest_command:
  #
  ###############################################################################
  # 1. Get the car state
  #    http://localhost:5000/get_vehicleinfo/YOURVIN
  ###############################################################################
  #
  psa_get_vehicle_live_info:
    url: "http://localhost:5000/get_vehicleinfo/{{vin}}"
    headers:
      User-Agent: "Home Assistant"
      Content-Type: "application/json; charset=utf-8"
    method: GET
  
  ds4_get_vehicle_live_info:
    url: "http://localhost:5000/get_vehicleinfo/<MY_VIN>"
    headers:
      User-Agent: "Home Assistant"
      Content-Type: "application/json; charset=utf-8"
    method: GET
  
  # ###############################################################################
  # # 2. Get the car state from cache to avoid to use PSA API too much
  # #    http://localhost:5000/get_vehicleinfo/YOURVIN?from_cache=1
  # ###############################################################################
  # 
  psa_get_vehicle_info:
    url: "http://localhost:5000/get_vehicleinfo/{{vin}}?from_cache=1"
    headers:
      User-Agent: "Home Assistant"
      Content-Type: "application/json; charset=utf-8"
    method: GET
  
  ds4_get_vehicle_info:
    url: "http://localhost:5000/get_vehicleinfo/<MY_VIN>?from_cache=1"
    headers:
      User-Agent: "Home Assistant"
      Content-Type: "application/json; charset=utf-8"
    method: GET
 

Attached full log (with my VIN replaced by <MY_VIN>) : 2025-02-28 - PSA Controler errors during charging .log

chmtc94 avatar Feb 28 '25 15:02 chmtc94

Usualy the updates come from Stellantis while charging, but since a couple weeks(?) it only changes the charging state and doesn't update anything more.

What helps for me is sending a wake up signal. With that it doesn't update anything update verything. Stellantis just doesn't push any updates during charging itself.

JaySea77 avatar May 25 '25 10:05 JaySea77

Could you share what you do fort wakeup in homeassistant?!

In my Case IT doesnt Work. I have to lock / unlock car or Open the door... Just in this Case i get maybe an update

dnnrwttr avatar May 26 '25 14:05 dnnrwttr

See the api https://github.com/flobz/psa_car_controller/blob/master/docs/psacc_api.md point 7

JaySea77 avatar May 26 '25 14:05 JaySea77

Ok , Same url i already use in my Script within my configuration.yaml with

rest_command: mokka_wakeup: url: http://localhost:5000/wakeup/VXKUXXXXXXXXXX And than i Trigger IT from an Automation every 5 mins

Or did you use it in another way?

dnnrwttr avatar May 26 '25 20:05 dnnrwttr

I usually don't use the wake up in an automation. I only update with option 2 from the url to update from cache. Stellantis will temporarily ban you quite fast if you do too many api calls. The api limit seems to be really low.

JaySea77 avatar May 26 '25 20:05 JaySea77

A few days ago the wakeup Just rund every hour once... But Same Problem, cant get current accu Status... Thats quiet terrible cause my evcc doesnt make Sense :(

dnnrwttr avatar May 26 '25 20:05 dnnrwttr

exact same issue here.

since 2 weeks at least, PSACC doesn't get any update from API when and only when the car (E-208) is charging.

in PSACC logs, we can see the token is invalid or revoked, which is weird, because once charging is finished (by depluging the charge cable), PSACC get informations from API flawlessly.

the wakeup command has the same result than the PSACC wakeup script (asked automaticaly by the script when Battery level doesn't change during a too long period of time during charging), token invalid. the charge level info directly get from API ( no "?from_cache=1") doesn't change anything.

I suspect PSACC ask too frequently the API to wakeup the car during charge sessions (every minutes according to logs, whatever the update cron we set), specially when we use a slow charge speed mode (3.6kw, which is the highest I can get at home).

logs I get are exactly the same than above :

2025-02-28 14:08:26,921 :: INFO :: ask wakeup to <MY_VIN>
2025-02-28 14:08:26,922 :: INFO :: topic: psa/RemoteServices/from/cid/AC-ACNT200005303345/VehCharge/state: {'action': 'state'}
2025-02-28 14:08:28,565 :: WARNING :: remote_refresh_token isn't defined
2025-02-28 14:08:28,804 :: ERROR :: Error during activation: {'err': 'NOK:FORBIDDEN'}
2025-02-28 14:08:29,039 :: ERROR :: Can't refresh remote token, please redo otp procedure
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 177, 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 208, in _get_remote_access_token
    self.remoteCredentials.access_token = data["access_token"]
KeyError: 'access_token'

If I update datas from Mypeugeot app on my phone, wakeup works fine, and PSACC get the updated information, but just once. MyPeugeot app ask me the pin code frequently, when and only when car is charging, and PSACC is stuck with non-updated values. if car is not charging, the wakeup command works flawlessly (http 200 response from API in PSACC logs).

I've revoked all my tokens in MyPeugeot app, registered again MyPeugeot app and PSACC, no change. I've redone the OTP procedure, but no change.

I've tried to reduce the update frequency to 5 minutes, no change. I've rebuilt the PSACC docker, no change. I've downgraded from 3.5.6 to 3.5.3, no change.

This is pretty annoying, because it literraly kills the main goal of the app: stopping the charge at 80% battery level. @flobz , can you help about this ?

Trebila avatar Jun 10 '25 10:06 Trebila

Opel told me that the car is.going to "sleep" to prevent damage / overconsumption of the 12v battery... I dont know If this answer make Sense or is realistic but maybe an explanation why the values are updating in the Moment of opening/closing the car?!

dnnrwttr avatar Jun 10 '25 22:06 dnnrwttr

see my post ( https://github.com/flobz/psa_car_controller/issues/1080 ) , I fixed the issue I had.

Trebila avatar Jun 16 '25 14:06 Trebila