Closed cedsib closed 2 years ago
As an info, I tried with the app version 1.28.1 and had nearly the same result :
Traceback (most recent call last):
File "/root/psa_car_controller/MyPSACC.py", line 224, in get_vehicles
res = self.api().get_vehicles_by_device()
File "/root/psa_car_controller/psa_connectedcar/api/vehicles_api.py", line 1331, in get_vehicles_by_device
(data) = self.get_vehicles_by_device_with_http_info(**kwargs) # noqa: E501
File "/root/psa_car_controller/psa_connectedcar/api/vehicles_api.py", line 1414, in get_vehicles_by_device_with_http_info
collection_formats=collection_formats)
File "/root/psa_car_controller/MyPSACC.py", line 118, in call_api
raise e
File "/root/psa_car_controller/MyPSACC.py", line 105, in call_api
_preload_content, _request_timeout)
File "/root/psa_car_controller/psa_connectedcar/api_client.py", line 161, in __call_api
_request_timeout=_request_timeout)
File "/root/psa_car_controller/psa_connectedcar/api_client.py", line 351, in request
headers=headers)
File "/root/psa_car_controller/psa_connectedcar/rest.py", line 238, in GET
query_params=query_params)
File "/root/psa_car_controller/psa_connectedcar/rest.py", line 228, in request
raise ApiException(http_resp=r)
psa_connectedcar.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'X-Backside-Transport': 'FAIL FAIL', 'Connection': 'close', 'Cache-Control': 'no-store, no-cache, must-revalidate, private', 'Content-Type': 'application/hal+json', 'Date': 'Mon, 29 Mar 2021 21:14:24 GMT', 'Expires': '0', 'X-Global-Transaction-ID': '08f333a560624330f86f4d9f', 'Access-Control-Expose-Headers': 'APIm-Debug-Trans-Id, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Global-Transaction-ID', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Set-Cookie': 'rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 28-Mar-2021 21:14:24 GMT, JSESSIONID=X-486IxvdefSJe29JEKk5BZUtI5mMEr0Rhiu1s-6; path=/, PSACountry=FR;Domain=.groupe-psa.com;Path=/'})
HTTP response body: {"uuid":"a9d2bdd8-0f70-47c1-af26-7d907a2c052f","code":40410,"message":"No vehicule found"}
Traceback (most recent call last):
File "app_decoder.py", line 153, in <module>
if car.label == "unknown":
AttributeError: 'NoneType' object has no attribute 'label'
if car.label == "unknown": Replace this line by : if car.label is None: I will fix it later.
J'ai l'impression qu'il y a un problème dans le retour de l'API :
psa_connectedcar.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'X-Backside-Transport': 'FAIL FAIL', 'Connection': 'close', 'Cache-Control': 'no-store, no-cache, must-revalidate, private', 'Content-Type': 'application/hal+json', 'Date': 'Tue, 30 Mar 2021 07:28:09 GMT', 'Expires': '0', 'X-Global-Transaction-ID': '945fb68f6062d30936bb993f', 'Access-Control-Expose-Headers': 'APIm-Debug-Trans-Id, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Global-Transaction-ID', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Set-Cookie': 'rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Mon, 29-Mar-2021 07:28:09 GMT, JSESSIONID=fIElYLLV2vTVkyfOl4LqK5e9oGeyNm_cruvdkTn3; path=/, PSACountry=FR;Domain=.groupe-psa.com;Path=/'})
HTTP response body: {"uuid":"f57a652f-ff09-41b4-b925-c596fb6ccbf6","code":40410,"message":"No vehicule found"}
Traceback (most recent call last):
File "app_decoder.py", line 153, in <module>
if car.label is None:
AttributeError: 'NoneType' object has no attribute 'label'
Yes you are right, the problem is :
HTTP response body: {"uuid":"14bf8c25-0d0a-4068-a675-938dbe51facf","code":40410,"message":"No vehicule found"}
When do you receive your car? Do you buy it or is it a loan (LDD) ?
It's a car I bought in 2019 And I see it in the app with some localisation & so on
Your car is probably not compatible with psa API V4. It's the one I use.
If you have the skills you can use mitmproxy to analyse trafic between android app and psa api to know what api is used. But me I can't do much sorry.
Yep, same here, with same car.
Here it is for some details from mitm
That's great you were able to access the logs from the API. I tried but without any success! Hoping it could help @flobz!
Just to add a few comment, my car is brand new (not even delivered yet), so it's strange that PSA uses an old API for it. Actually, it's strange that cars can be accessed through one api and not the others.
If you car isn't delivered it can be normal that API returned 404. Do you see in mitmproxy a status request with positions, fuel level...
Je vais jeter un oeil, mais elle arrive à la concession, donc elle est construite, et l'appli MyPeugot "la voit".
pour le moment je vois rien
What kind of car have you bought @moulagaufre ? You may have the same problem that I have ?
I was not able to get mitm
working, glad you could.
Maybe @flobz can still connect to this old API 🤞 🤞 🤞 🤞 🤞 🤞
The new 5008
OK, so same here.
Just to let you know that this error disappear once the "Telemaintenance" service is subscribed fro the car. Now I have this:
The car is a Nouveau 5008: vf3mrhnsum
Btw, Tronity.io can access the car ok
of course it's a petrol car, not a hybrid or EV :)
Should be ok with the last commit: c240a80
Yes better; Now I'm stuck at the SMS OTP thing, where I never receive the SMS to authenticate .....
And tronity.io didn't ask for a SMS, only credential to MyPeugeot.
Yeah that's normal, you probably doesn't have the ability to control your car, like preconditionning?
Try with "--remote-disable" argument
Correct, no preconditionning feature. I'll try the remote disable.
Hi ! i've the same problem with a petrol car "Peugeot 308", i've the same message from above :
Traceback (most recent call last): File "/psa_car_controller/my_psacc.py", line 172, in get_vehicles res = self.api().get_vehicles_by_device() File "/psa_car_controller/psa_connectedcar/api/vehicles_api.py", line 1331, in get_vehicles_by_device (data) = self.get_vehicles_by_device_with_http_info(**kwargs) # noqa: E501 File "/psa_car_controller/psa_connectedcar/api/vehicles_api.py", line 1400, in get_vehicles_by_device_with_http_info return self.api_client.call_api( File "/psa_car_controller/libs/oauth.py", line 77, in call_api raise e File "/psa_car_controller/libs/oauth.py", line 59, in call_api return self._ApiClient__call_api(resource_path, method, File "/psa_car_controller/psa_connectedcar/api_client.py", line 157, in __call_api response_data = self.request( File "/psa_car_controller/psa_connectedcar/api_client.py", line 347, in request return self.rest_client.GET(url, File "/psa_car_controller/psa_connectedcar/rest.py", line 234, in GET return self.request("GET", url, File "/psa_car_controller/psa_connectedcar/rest.py", line 228, in request raise ApiException(http_resp=r) psa_connectedcar.rest.ApiException: (404) Reason: Not Found
Well now that I have the car, the tool connect to PSA API fine, but there is no trip data, even after a few days. Trips are appearing in the MyPeugeot app (well, when it works ....). Is this telemetry OTA thing is only for electric cars ? Reading the PSA dev pages, it doesnt seem so, but for some reason, I have nothing available for my 5008.
Digging a little bit into this issue, here is what I got from Burp when intercepting API requests. When I run psa_controller with remote disable, only two calls are made to PSA API, one to authenticate, and then: GET /connectedcar/v4/user/vehicles?client_id=xxxxx HTTP/1.1
Answer is: "_links":{"self":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles?indexRange=0-&pageSize=60&locale=fr-FR"}},"total":1,"_embedded":{"vehicles":[{"id":"1557495449334d7a49334d54453d","vin":"xx","brand":"Peugeot","label":"NOUVEAU 5008","pictures":["http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=001","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=002","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=003","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=004","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=005","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=006","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=007","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=008","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=009","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=010","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=011","http://visuel3d.peugeot.com/V3DImage.ashx?client=miseco&format=png&back=0&version=1PP7CMTNP1B0A0E0&color=0MM00NF4&trim=0P0J0RFI&OPT1=DAQ0&OPT2=DMO0&OPT3=DUF0&OPT4=DWP2&OPT5=DWY1&view=012"],"_links":{"alerts":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d/alerts"},"trips":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d/trips"},"self":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d?locale=fr-FR"},"lastPosition":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d/lastPosition"},"telemetry":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d/telemetry"},"maintenance":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d/maintenance"},"status":{"href":"https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d/status"}}}]},"currentPage":1,"totalPage":1}
psa_controller doesn't try to access any of those api
I tried to access the telemtry URL for instance with CURL: curl -i -s -k -X $'GET' -H $'Host: api.groupe-psa.com' -H $'Accept-Encoding: gzip, deflate' -H $'Accept: application/hal+json ' -H $'User-Agent: Swagger-Codegen/4.0/python' -H $'Authorization: Bearer xxxxxxx' -H $'x-introspect-realm: clientsB2CPeugeot' -H $'Content-Type: application/json' -H $'Connection: close' $'https://api.groupe-psa.com/connectedcar/v4/user/vehicles/15574e6d4d7a51324d57566c595749774e54686c5a6a41324d7a41314d6a67344f574d3359574e68597a6b305a474d794d445532595449334d7a49334d54453d/telemetry'
but got a a 401.
Is it expected behavior ?
My bad adding &client_id gives access, well sort-of. As none of the endpoint (except) self are returnong meaning ful results. It's either internal server error or 40400 Not found.
But the python code still doesn't try any of the URLs, so is that normal ?
Did you enable record option?
I did. But with or without -r option still the same, only 2 api calls made by the python script: the oauth POST and the first GET. Nothing else.
Command line used: python server.py --remote-disable -f oli.json --debug DEBUG
Well now that I have the car, the tool connect to PSA API fine, but there is no trip data, even after a few days. Trips are appearing in the MyPeugeot app (well, when it works ....). Is this telemetry OTA thing is only for electric cars ? Reading the PSA dev pages, it doesnt seem so, but for some reason, I have nothing available for my 5008.
Hello,
I bought my new Peugeot 208 GT 130PS with petrol engine at the beginning of May.
Now I also wanted to experiment a bit with the API and I noticed that none of my previous 72 journeys can be retrieved via the API.
However, I have listed all my trips in the MyPeugeot app and the Telemaintaince service is also booked and activated.
So I have a similar problem to @moulagaufre.
I only get a 404 response from each of the API endpoints e.g. "/trips" , "/status" , "/telemetry" with the information that no data has been saved yet.
Does anyone know why this is happening?
Many thanks in advance :)
As I see it, either: 1/ the service is only for hybrid/ev vehicles (even if that's nowhere written in the PSA documentation, quite the opposite in fact, and also because of 3/ I don't think that's the case); 2/ the service is closed for now for non EV and will be open later (not sure if it actually works for every hybrid/ev owner right now, or is it quite erratic ?); 3/ the service is only open to professionals. I found some companies that claims to give you fleet management capabilities (including geoloc) leveraging on the peugeot builtin systems. 4/ something else ?
@flobz Out of curiosity, on your EV car, what is the result of the API call made by mypeugeot: POST /api/v1/user/vehicles/YOURVIN/contracts?culture=fr_FR&v=1.29.1
And the answer has something related to BTA (which is if I undertood correctly the hardware component in the car that has the sim card and transmit all telemetry data sniffed on the CAN bus). Maybe there is a difference here beetwen our cars. Here is what I get:
{"success":{"bta":{"type":"DEX BTA","status":0,"level":0},"services":[],"nac":[{"type":"NAVCOZAR","status":2,"validity":{"start":1620172800,"end":1714867200},"is_extensible":false,"title":"Pack Navigation connect\u00e9e","category":"connected_services"}],"club":[],"adsd":{"type":"ADSD","status":0},"tmts":{"type":"TMTS","status":2,"validity":{"start":1619136000,"end":1934755200},"is_extensible":false,"title":"TELEMAINTENANCE","category":"connected_services"}}}
My output is similar
@flobz Can you post your result of the API call "POST /api/v1/user/vehicles/YOURVIN/contracts?culture=fr_FR&v=1.29.1", please ?
This information is might useful for the community with similar problems :)
@moulagaufre Can give me an instruction for getting BTA information, please ?
I'm getting the same error for a DS7 Crossback (non-electric) from 2020 using the latest MyDS APK (v1.27.1, later versions are XAPK) available.
It seems to be using the old API - when opening the "DS Connect Apps" function in the car itself, it tells me that I can not use those apps yet, but can connect using MyDS and that those apps will be enabled later.
Both issues might be related.
Edit: This has nothing to do with me using v1.27.1 of the app, has it? Edit 2: Nope, same issue when using the unpacked "com.psa.mym.myds.apk" from the latest XAPK version.
Hello @pannal, the DS Connect Apps will unfortunately never be available again. Stellantis has abandoned this functionality. This message you get in your car is just a placeholder.
Your MyDS app works independently of this functionality.
Using the API only seems to work with hybrids and electric cars.
I myself drive a Peugeot 208 GT (petrol) and have the same problem of no data being retrievable in the API.
However, I analyse the app and can at least retrieve the total mileage via another API. However, I have to analyse everything else first. It might be possible to get the rest of the data. If I manage to do that, I will publish instructions here and make them available to all of you.
Content of /api/v1/user/vehicles/VR3UHZKXZLT11XXXX/contracts?culture=fr_FR&v=1.27.0
{
"success": {
"adsd": {
"status": 0,
"type": "ADSD"
},
"bta": {
"level": 0,
"status": 0,
"type": "DEX BTA"
},
"club": [],
"nac": [],
"remoteLev": {
"associationId": "05290563-836f-4da6-82b8-xxxxxxxx",
"category": "connected_services",
"fds": [
"NCG01",
"NBM01",
"NAS01",
"NAO02"
],
"is_extensible": false,
"status": 2,
"title": "e-Commandes à distance",
"type": "REMOTELEV",
"validity": {
"end": 1919721600,
"start": 1604016000
}
},
"services": []
}
}
However, I analyze the app and can at least retrieve the total mileage via another API. However, I have to analyse everything else first. It might be possible to get the rest of the data. If I manage to do that, I will publish instructions here and make them available to all of you.
Good job. It would be nice to make psa_car_controller compatible with thermal car ! :)
OH YEAH!
Hello folks, Here's a quick status update regarding the API for thermal engines.
My Peugeot 208 GT has currently been in the repair workshop since the beginning of the week, as I have had constant transmission faults. Peugeot told me that this is a software error and can be ignored.
Now, since Wednesday of last week, it has turned out that it is a defective solenoid valve and that this is now known to be a series problem.
Accordingly, I could not continue my work on the API and so far I have not gone beyond the total kilometre value.
In the meantime, Peugeot has also updated its developer page and added remote commands for e-cars.
I'm afraid I won't get any more data either, as the data transmission in the car is sent directly to Peugeot via the Telemaintaince service and this is not offered in this form for e-cars.
In summary, I don't think that thermal cars are able to provide all the data that an e-car offers via an API.
I'm very sorry that I couldn't make any progress either 😔 @flobz I think this thread can be closed with that.
it asks me for OTP even with --remote-disable. i drive a NOUVELLE 208 (petrol).
HTTP response body: {"uuid":"0c3a79d5-bb67-448f-aa7d-669a039d1348","code":40410,"message":"No vehicule found"}
My vin: VR3UPHMDKXXXXXX
No update so closing the thread.
Is there any update on this matter? I just discovered this repo and am trying to get data from my Peugeot 208 (petrol, 2020 model) but got the same "Not vehicule found" error. I tried to connect via stellantis (PSA) api v4 and managed to get an access_token, I then tried the following endpoint:
https://api.groupe-psa.com/connectedcar/v4/user/vehicles
With data from my dev account, registered via PSA dev portal and managed to get the following error:
{ "httpCode":"401", "httpMessage":"Unauthorized", "moreInformation":"Not registered to plan" }%
Which I guess is related to the fact that the API is not open to the public yet (weird that oAuth2 works). I guess I'm stuck at a dead end for now.
Is there any update on this matter? I just discovered this repo and am trying to get data from my Peugeot 208 (petrol, 2020 model) but got the same "Not vehicule found" error. I tried to connect via stellantis (PSA) api v4 and managed to get an access_token, I then tried the following endpoint:
https://api.groupe-psa.com/connectedcar/v4/user/vehicles
With data from my dev account, registered via PSA dev portal and managed to get the following error:
{ "httpCode":"401", "httpMessage":"Unauthorized", "moreInformation":"Not registered to plan" }%
Which I guess is related to the fact that the API is not open to the public yet (weird that oAuth2 works). I guess I'm stuck at a dead end for now.
I have been trying since a year and also never got it to work. Also a Peugeot 208 2020 Petrol version. Same issue that it asks for OTP-config after login on the page. Tried docker, windows, and HA-addon; nothing.
If you manage to get some info out of this, please let me know!
Is there any update on this matter? I just discovered this repo and am trying to get data from my Peugeot 208 (petrol, 2020 model) but got the same "Not vehicule found" error. I tried to connect via stellantis (PSA) api v4 and managed to get an access_token, I then tried the following endpoint:
https://api.groupe-psa.com/connectedcar/v4/user/vehicles
With data from my dev account, registered via PSA dev portal and managed to get the following error:{ "httpCode":"401", "httpMessage":"Unauthorized", "moreInformation":"Not registered to plan" }%
Which I guess is related to the fact that the API is not open to the public yet (weird that oAuth2 works). I guess I'm stuck at a dead end for now.I have been trying since a year and also never got it to work. Also a Peugeot 208 2020 Petrol version. Same issue that it asks for OTP-config after login on the page. Tried docker, windows, and HA-addon; nothing.
If you manage to get some info out of this, please let me know!
Still the same error unfortunately, 404 "No vehicule found". Still asks for OTP which i cannot provide.
Describe the bug Based on the version 1.29 https://www.apkmirror.com/apk/peugeot-automobiles/mypeugeot-app/mypeugeot-app-1-29-0-release/mypeugeot-app-1-29-0-android-apk-download/download/?forcebaseapk
Here is the error I get when I try to get the credentials : (my vehicule is a "Nouveau 5008" that I can clearly see in "MyPeugeot" app or website).
Additional context