psa_car_controller icon indicating copy to clipboard operation
psa_car_controller copied to clipboard

Error trying to login

Open FilipeOS opened this issue 11 months ago • 34 comments

Describe the bug When I try to login, after it got disconnected from my account, I get this error on login screen.

Environment (please complete the following information): Current version: v3.6.2 Installation method: Home Assistant OS Core: 2025.12.5 Supervisor: 2025.12.3 Operating System: 16.3 Frontend: 20251203.3

Additional context Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py", line 468, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py", line 463, in _make_request httplib_response = conn.getresponse() ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/http/client.py", line 1374, in getresponse response.begin() File "/usr/lib/python3.11/http/client.py", line 318, in begin version, status, reason = self._read_status() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/http/client.py", line 279, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/socket.py", line 706, in readinto return self._sock.recv_into(b) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/ssl.py", line 1311, in recv_into return self.read(nbytes, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/ssl.py", line 1167, in read return self._sslobj.read(len, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TimeoutError: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/requests/adapters.py", line 644, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py", line 802, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/urllib3/util/retry.py", line 552, in increment raise six.reraise(type(error), error, _stacktrace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/urllib3/packages/six.py", line 770, in reraise raise value File "/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py", line 716, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py", line 470, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "/usr/local/lib/python3.11/dist-packages/urllib3/connectionpool.py", line 358, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='id-dcr.peugeot.com', port=443): Read timed out. (read timeout=10) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 44, in __init__ res = requests.post(apk_parser.host_brandid_prod + "/GetAccessToken", ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/requests/adapters.py", line 690, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='id-dcr.peugeot.com', port=443): Read timed out. (read timeout=10) HOST_BRANDID : https://id-dcr.peugeot.com/mobile-services sitecode: AP_PT_ESP

FilipeOS avatar Jan 05 '26 09:01 FilipeOS

I face currently the same issue with HOST_BRANDID : https://id-dcr.peugeot.com/mobile-services sitecode: AP_DE_ESP

since the container is running into a timeout I adapted the timeout from 10s to 60s docker exec -u 0 -it psa_car_controller_psacc_1 sh -c "sed -i '20s/.*/TIMEOUT_IN_S = 60/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py && sed -i '56s/.*/ timeout=TIMEOUT_IN_S/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py && docker restart psa_car_controller_psacc_1"

After that the connection seems to be established, but now I get a certificate error:

`2026-01-05 09:51:37,012 :: INFO :: Initial setup... 2026-01-05 09:51:50,125 :: ERROR :: Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 105, in __fetch_user_info res_dict = res2.json()["success"] ~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'success' {"code":"495", "message": "Invalid or expired client certificate"} 2026-01-05 09:51:50,127 :: ERROR :: Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 105, in __fetch_user_info res_dict = res2.json()["success"] ~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'success' {"code":"495", "message": "Invalid or expired client certificate"} Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 105, in __fetch_user_info res_dict = res2.json()["success"] ~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'success'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/web/view/config_views.py", line 137, in connectPSA INITIAL_SETUP = InitialSetup(app_name, email, password, countrycode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 76, in init self.user_info = self.__fetch_user_info() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 113, in __fetch_user_info raise ConnectionError(msg) from ex ConnectionError: Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 105, in __fetch_user_info res_dict = res2.json()["success"] ~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'success' {"code":"495", "message": "Invalid or expired client certificate"}`

x-MaxG-x avatar Jan 05 '26 09:01 x-MaxG-x

https://github.com/flobz/psa_car_controller/issues/1159 is reporting also a certificate error

x-MaxG-x avatar Jan 05 '26 10:01 x-MaxG-x

Same issue here:

Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 105, in __fetch_user_info res_dict = res2.json()["success"] ~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'success' {"code":"495", "message": "Invalid or expired client certificate"}

HAusr01 avatar Jan 05 '26 10:01 HAusr01

exact same thing...

Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 105, in __fetch_user_info res_dict = res2.json()["success"] ~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'success' {"code":"495", "message": "Invalid or expired client certificate"}

ValentinMarchand avatar Jan 05 '26 11:01 ValentinMarchand

I got it running by the dirty change proposed by jmA500 on Aug 31, 2024:

I extracted the actual MyPeugeot.apk from my android phone:

adb shell pm list packages | grep peugeot

With the given path I pulled it to my PC:

adb pull /data/app/~~.../base.apk ./MyPeugeot.apk

This apk now needs to be pushed into the docker container:

docker cp MyPeugeot.apk psa_car_controller_psacc_1:/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk

Set Version to 1.51.1 (which is currently the actual version)

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i 's/APP_VERSION = .*/APP_VERSION = "1.51.1"/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

Disable the download-command

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i 's/urlretrieve_from_github(GITHUB_USER,/# urlretrieve_from_github(GITHUB_USER,/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

Add an manual call of the decode-function in line 76

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i '76i\ get_content_from_apk("/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk", country_code)' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

optional: Set Timeout to 60 seconds

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i '20s/.*/TIMEOUT_IN_S = 60/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

Remove old Certificates and ID-Files

docker exec -it psa_car_controller_psacc_1 sh -c "rm -f /var/lib/psa_car_controller/cert.p12 /var/lib/psa_car_controller/*.pem /var/lib/psa_car_controller/client_id"

Restart container

docker restart psa_car_controller_psacc_1

Check the logs if container is starting correctly

docker logs -f psa_car_controller_psacc_1

After that I was able to start authentification again.

x-MaxG-x avatar Jan 05 '26 11:01 x-MaxG-x

This is too complex for me. Will it be possible to integrate this workaround into a future update of the controller?

Abflussrohr avatar Jan 05 '26 11:01 Abflussrohr

This is too complex for me. Will it be possible to integrate this workaround into a future update of the controller?

Hi @Abflussrohr, I fear, this needs to be done by @flobz himself. I guess, he needs to update the APKs for the different brands in https://github.com/flobz/psa_apk and the version in https://github.com/flobz/psa_car_controller/blob/8955b06ede28dffec7ef9ed8c2c3a27dd2546b1f/psa_car_controller/psa/setup/app_decoder.py#L17 I am not sure, if I miss additional changes, which are required. My solution is just a quick and dirty workaround until a official new version becomes available.

x-MaxG-x avatar Jan 05 '26 13:01 x-MaxG-x

it stopped working for me too today, at 11 AM (French hour).

when I try tp get a new token in the PSACC user config page, I get this:

Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 105, in __fetch_user_info res_dict = res2.json()["success"] ~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'success' {"code":"495", "message": "Invalid or expired client certificate"}

Trebila avatar Jan 05 '26 18:01 Trebila

I got it running by the dirty change proposed by jmA500 on Aug 31, 2024:

I extracted the actual MyPeugeot.apk from my android phone:

adb shell pm list packages | grep peugeot

With the given path I pulled it to my PC:

adb pull /data/app/~~.../base.apk ./MyPeugeot.apk

This apk now needs to be pushed into the docker container:

docker cp MyPeugeot.apk psa_car_controller_psacc_1:/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk

Set Version to 1.51.1 (which is currently the actual version)

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i 's/APP_VERSION = .*/APP_VERSION = "1.51.1"/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

Disable the download-command

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i 's/urlretrieve_from_github(GITHUB_USER,/# urlretrieve_from_github(GITHUB_USER,/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

Add an manual call of the decode-function in line 76

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i '76i\ get_content_from_apk("/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk", country_code)' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

optional: Set Timeout to 60 seconds

docker exec -u 0 -it psa_car_controller_psacc_1 sed -i '20s/.*/TIMEOUT_IN_S = 60/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

Remove old Certificates and ID-Files

docker exec -it psa_car_controller_psacc_1 sh -c "rm -f /var/lib/psa_car_controller/cert.p12 /var/lib/psa_car_controller/*.pem /var/lib/psa_car_controller/client_id"

Restart container

docker restart psa_car_controller_psacc_1

Check the logs if container is starting correctly

docker logs -f psa_car_controller_psacc_1

After that I was able to start authentification again.

Any idea how this could work with iOS devices? I´m currently facing the same issue of the invalid or expired client certificate. Your workaround seems to be android specific.

SirBenga avatar Jan 05 '26 19:01 SirBenga

I've deleted all my registered devices (all tokens/id are deleted) following this procedure, but still the same:

https://peugeot.stellantis-customercare.com/peugeot/s/article/AP-J-ai-un-probl%C3%A8me-avec-mon-code-PIN-Code-de-s%C3%A9curit%C3%A9-ou-je-souhaites-le-changer-Que-dois-je-faire?language=fr

Trebila avatar Jan 06 '26 10:01 Trebila

it looks like stelantis changed the way to connect/authenticate to the dashboard. PSACC need to be adapted to work again.

Trebila avatar Jan 06 '26 11:01 Trebila

If stellantis changed the procedure, i'm wondering why it affects not all psacc users. Obviously only a few users having this issue.

SirBenga avatar Jan 07 '26 12:01 SirBenga

it could happen to everyone soon or late, when the token will be expired.

When I connect to the peugeot dashboard on my PC, the procedure is different, and I don't see the auth0 code in network developper mode anymore.

Trebila avatar Jan 07 '26 13:01 Trebila

it's getting worse: even my iphone app doesn't work anymore, authentication issue.

Trebila avatar Jan 08 '26 09:01 Trebila

Same here. I reinstalled the app, did some reboots of my iphone and tried to activate the app again. Took me several tries. Now it seems to work again. Not sure how stable. I was kicked out of the activation process due to outdated certificate.

SirBenga avatar Jan 08 '26 09:01 SirBenga

Same happened to me when I tried to configure PCC for the first time. Can't get past this error :/

ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='id-dcr.opel.com', port=443): Read timed out. (read timeout=10) HOST_BRANDID : https://id-dcr.opel.com/mobile-services sitecode: OP_PL_ESP

Uniquequ avatar Jan 08 '26 18:01 Uniquequ

@flobz Hi Florian Are you working on the new authentication process on Stellantis API already ?

Trebila avatar Jan 09 '26 12:01 Trebila

Ran into this issue today do not have an android phone so apk extract was not possible unlike in this comment but it allowed me to fix it using this comment to get an apk url.

I'm running PSA_CAR_CONTROLLER version 3.6.2 as a docker container in a proxmox LXC outside of HA.

⚠️ Now this is for MyOpel so update your commands accordingly to your specific app ⚠️

PSA Car Controller - APK Certificate Fix

Fix the certificate issue by manually updating the MyOpel APK.


Step 1: Enter the container

docker exec -u 0 -it psa_car_controller /bin/sh

Step 2: Download the XAPK

*** change xapp name in this command ***

curl -L -o /tmp/MyOpel.xapk "YOUR_APKCOMBO_DOWNLOAD_URL_HERE"

[!NOTE] Get a fresh download link from APKCombo — links expire quickly.
this links directly to My Opel apk get the correct version in the search and replace the token "YOUR_APKCOMBO_DOWNLOAD_URL_HERE"


Step 3: Extract the base APK from XAPK

The downloaded file is an XAPK bundle. Extract the actual APK:

*** change app name in this command ***

python3 -c "
import zipfile
import os

xapk_path = '/tmp/MyOpel.xapk'
output_dir = '/tmp/xapk_extracted'
os.makedirs(output_dir, exist_ok=True)

with zipfile.ZipFile(xapk_path, 'r') as z:
    for name in z.namelist():
        if name.endswith('.apk') and 'config.' not in name:
            print(f'Extracting: {name}')
            z.extract(name, output_dir)
"

you should see something like

Extracting: com.psa.mym.myopel.apk

If it returns nothing, it means either:

The XAPK doesn't contain a base APK matching the filter The file path is wrong You can debug by listing all files in the XAPK:

*** change app name in this command ***

python3 -c "
import zipfile
with zipfile.ZipFile('/tmp/MyOpel.xapk', 'r') as z:
    for name in z.namelist():
        print(name)
"

Step 4: Copy APK to correct location

*** From there your app name is just app.apk ***

cp /tmp/xapk_extracted/*.apk /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk

Verify it's a valid APK:

python3 -c "
from androguard.core.apk import APK
a = APK('/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk')
print('Package:', a.get_package())
print('Resources:', 'OK' if a.get_android_resources() else 'FAILED')
"

Step 5: Modify app_decoder.py

# Set APP_VERSION to 1.51.1
sed -i 's/APP_VERSION = "1.48.2"/APP_VERSION = "1.51.1"/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

# Comment out urlretrieve_from_github
sed -i 's/urlretrieve_from_github(GITHUB_USER, GITHUB_REPO, "", filename)/# urlretrieve_from_github(GITHUB_USER, GITHUB_REPO, "", filename)/' /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

# Change filename to use our APK path
python3 -c "
path = '/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py'
with open(path, 'r') as f:
    content = f.read()
content = content.replace(
    'filename = package_name.split(\".\")[-1] + \".apk\"',
    'filename = \"/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk\"'
)
with open(path, 'w') as f:
    f.write(content)
print('Done!')
"

Verify changes:

grep -E "APP_VERSION|urlretrieve|filename = " /usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app_decoder.py

you should see :

APP_VERSION = "1.51.1"
from psa_car_controller.psa.setup.github import urlretrieve_from_github
# urlretrieve_from_github(GITHUB_USER, GITHUB_REPO, "", filename)
filename = "/usr/local/lib/python3.11/dist-packages/psa_car_controller/psa/setup/app.apk"

Step 6: Remove old certificates

rm -f /var/lib/psa_car_controller/cert.p12 /var/lib/psa_car_controller/*.pem /var/lib/psa_car_controller/client_id

Step 7: Exit and restart

exit
docker restart psa_car_controller
docker logs -f psa_car_controller
  • Avoid using normal docker compose down && docker compose up -d it recreate the container and erase this temp fix

Troubleshooting

Issue Solution
Download URL expired Get fresh link from APKCombo
androguard shows "Missing AndroidManifest.xml" File is XAPK — extract base APK (Step 3)
Changes don't persist after restart Container might be ephemeral — check docker-compose volumes

Hope this help till @flobz have time to get around this issue 😃

emmanuel-blin avatar Jan 10 '26 02:01 emmanuel-blin

@emmanuel-blin worked like charm. Thanks a lot!!. I had to change some of your commands maybe because of my HA installation.

this #639 helped me out

Step1) to

docker exec -u 0 -it addon_b9f12d83_psacc /bin/bash

step7) to

docker restart addon_b9f12d83_psacc

i had to run the installation twice.

SirBenga avatar Jan 10 '26 08:01 SirBenga

the original authentication process is working again, now I get the data

HAusr01 avatar Jan 13 '26 18:01 HAusr01