Renault-Zoe-API icon indicating copy to clipboard operation
Renault-Zoe-API copied to clipboard

Renault migrated ZE services to 'My Renault app'

Open pimmeh opened this issue 5 years ago • 38 comments

I live in the Netherlands and since yesterday Renault migrated in a big bang from the Z.E. services to the 'My Renault App'. You had to re-register using VIN and activation code and the ZE-services website now redirects to https://www.services.renault-ze.com/restricted-country stating it no longer works and I have to use the My Renault App. That app works by itself but I was also using the API to view the status of my Zoe in my home automation system (Home Assistant). Shame on Renault that, without warning or migration time, they just stop supporting something we are using.

Is there any change you might look into this new API (if it is at all possible of course)?

pimmeh avatar May 30 '19 09:05 pimmeh

I no longer own a Renault Zoe, so I can't keep this API updated. Sorry.

edent avatar May 30 '19 09:05 edent

I am from Germany and here is nothing (yet) changed.

ivanbuzyka avatar May 30 '19 09:05 ivanbuzyka

@ivanbuzyka same here but now that it's been released in Netherlands, hopefully it's going to be launched in Germany too soon enough. At least there is actually an app now and it's just a matter of launching it here. I was scared it might all just be empty promises from Renault.

zeenix avatar May 30 '19 11:05 zeenix

My script I used for getting the info from my Zoe to Domoticz (https://www.domoticz.com/wiki/Renault_Zoe_API isn't working anymore as well... Damn you Renault... I'm trying to figure out the new method, but so far no luck.

(The new app is showing a new item; the number of kilometers on the odometer. That would be fun to get that info as well... and there might be more. Intresting)

Podariss avatar Jun 03 '19 08:06 Podariss

Same Problem ... From France. @Podariss The number of kilometers, it will be great on Domoticz :) It's the new server ...

renault-wrd-prod-1-euw1-myrapp-one.s3-eu-west-1.amazonaws.com

with a proxy, i find this command, but it's a data binary :-(

curl -H 'Host: renault-wrd-prod-1-euw1-myrapp-one.s3-eu-west-1.amazonaws.com' -H 'User-Agent: MYRenault/3 CFNetwork/978.0.7 Darwin/18.6.0' -H 'Proxy-Connection: keep-alive' https://renault-wrd-prod-1-euw1-myrapp-one.s3-eu-west-1.amazonaws.com

TheReiner avatar Jun 05 '19 18:06 TheReiner

Clicking the hyperlink we have an xml response:

Edit: XML response deleted to simplify the feed.

oncleben31 avatar Jun 06 '19 15:06 oncleben31

I wrote linked the script for Domoticz and Renault API, it seems to still be working in the UK. May have to come up with a different solution soon tho if renault are migrating to the new app.

timmchugh11 avatar Jun 16 '19 14:06 timmchugh11

Based on Proxy analysis;

  • configuration, static content, language strings and country-specific URLs configuration seems to be hosted on https://renault-wrd-prod-1-euw1-myrapp-one.s3-eu-west-1.amazonaws.com/ and are easily accessible by parsing the XML
  • authentication (at least for France) is then based on https://socialize.eu1.gigya.com/, and should be easy to replicate using the public gigya.com documentation
  • the API calls are then hosted on https://api-wired-prod-1-euw1.wrd-aws.com/

Sadly, Renault seems to have implemented some kind of certificate check on the API calls and I am unable to route the API calls throught the Proxy for packet analysis. If anyone finds a way to root the API calls through a proxy, then I can work on the new Python package.

epenet avatar Jun 17 '19 20:06 epenet

Regarding the token

It looks like it uses gigya for tokens and login:

$ curl -v -XGET https://accounts.eu1.gigya.com/accounts.login\?apiKey\=3_5x-2C8b1R4MJPQXkwTPdIqgBpcw653Dakw_ZaEneQRkTBdg9UW9Qg_5G-tMNrTMc\&loginID\[email protected]\&password\=Somethinghere
{
  "callId": "d05b1c8b8a594040aca392a6839d0d3a",
  "errorCode": 0,
  "apiVersion": 2,
  "statusCode": 200,
  "statusReason": "OK",
  "time": "2019-04-09T08:40:45.936Z",
  "registeredTimestamp": 1550570591,
  "UID": "6dsadsa",
  "UIDSignature": "asdas",
  "signatureTimestamp": "1554799245",
  "created": "2019-02-19T10:03:11.326Z",
  "createdTimestamp": 1550570591,
  "isActive": true,
  "isRegistered": true,
  "isVerified": true,
  "lastLogin": "2019-04-09T08:40:45.927Z",
  "lastLoginTimestamp": 1554799245,
  "lastUpdated": "2019-02-19T10:03:50.220Z",
  "lastUpdatedTimestamp": 1550570630220,
  "loginProvider": "site",
  "oldestDataUpdated": "2019-02-19T10:03:11.326Z",
  "oldestDataUpdatedTimestamp": 1550570591326,
  "profile": {
    "email": "[email protected]"
  },
  "registered": "2019-02-19T10:03:11.462Z",
  "socialProviders": "site",
  "verified": "2019-02-19T10:03:50.220Z",
  "verifiedTimestamp": 1550570630220,
  "newUser": false,
  "sessionInfo": {
    "cookieName": "gac_3_5x-2C8b1R4MJPQXkwTPdIqgBpcw653Dakw_ZaEneQRkTBdg9UW9Qg_5G-tMNrTMc",
    "cookieValue": "cfdsfdsfds"
  }
}

Which then can be used to a get a JWT token:

$ curl -v -XGET https://accounts.eu1.gigya.com/accounts.getJWT\?APIKey\=3_5x-2C8b1R4MJPQXkwTPdIqgBpcw653Dakw_ZaEneQRkTBdg9UW9Qg_5G-tMNrTMc\&login_token\=cfdsfdsfds(cookievaluefrom above)\&authMode\=cookie

{
  "callId": "cf44107a14bb4fd08412a2ef9735b5e2",
  "errorCode": 0,
  "apiVersion": 2,
  "statusCode": 200,
  "statusReason": "OK",
  "time": "2019-04-09T08:42:42.022Z",
  "ignoredFields": "",
  "id_token": "eyJ0....realjwttokenhere...nCA"
}

And yes it seems to be using certificate pinning for the actual api access

svrist avatar Jun 17 '19 20:06 svrist

On a french forum a Renault dev is teasing future features. API is inside.

On another post he is explaining the update logic of the data with the new app

oncleben31 avatar Jun 30 '19 00:06 oncleben31

Maybe it will help...

i found the ApiKey Amazon ;-)

Server: https://api-wired-prod-1-euw1.wrd-aws.com Key : IWmCqlG8cfNeNHGADD0WhkWHbi05k0RL

TheReiner avatar Jul 05 '19 02:07 TheReiner

API is "cracked". I have it running on Node-RED now using the hard work of James

https://muscatoxblog.blogspot.com/2019/07/delving-into-renaults-new-api.html

Required keys are easily found in the APK.

yoh-there avatar Jul 19 '19 13:07 yoh-there

@Podariss, @TheReiner : do you intend to update Domoticz with Renault's new api described on muscatoxblog.blogspot.com ? I'm just starting / learning with Domoticz and feel too newbie to do it by myself in the short time

OhSoGood avatar Jul 22 '19 14:07 OhSoGood

@epenet how about a new home assistant integration ? @jamesremuscat Have you a roadmap for a python package ?

oncleben31 avatar Jul 22 '19 14:07 oncleben31

@OhSoGood , I really hope so. Had it working in Domoticz, but now my graphs are so empty ;-(

Podariss avatar Jul 23 '19 05:07 Podariss

Hi all, I have followed the instructions from https://muscatoxblog.blogspot.com/2019/07/delving-into-renaults-new-api.html, and built a simple test script in Python, but I cannot seem to get a Kamereon token. It keeps erroring regardless of the accountId I provide. If someone has managed to get it working I'd appreciate some pointers...

epenet avatar Jul 23 '19 17:07 epenet

Somebody added a comment there detailing that step.

yoh-there avatar Jul 24 '19 07:07 yoh-there

I'm still stuck, but maybe it's a problem with my account? Anyway, I created a mockup script here: https://github.com/epenet/Renault-Zoe-API/tree/newapimockup/Test

You'll need to edit the Credentials.json file, and set the four parameters

  • "RenaultServiceLocation": "fr_FR",
  • "RenaultServicesUsername": "username",
  • "RenaultServicesPassword": "password",
  • "VIN": "vin"

Then just run MyRenault.py

epenet avatar Jul 24 '19 09:07 epenet

A user reported in muscat's blog comments a possible solution (at least for him/her)

yoh-there avatar Jul 24 '19 09:07 yoh-there

Following latest comment in muscat's blog, and analysing the Node-RED implementation (https://canze.fisch.lu/access-renault-api-using-node-red-v2/), I was able to get it working in Python.

The updated mockup scripts are available on https://github.com/epenet/Renault-Zoe-API/blob/newapimockup/Test/MyRenault.py

epenet avatar Jul 24 '19 10:07 epenet

Clicking the hyperlink we have an xml response:

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
...
<Contents>
<Key>configuration/android/config_en_GB.json</Key>
<LastModified>2019-02-07T08:39:02.000Z</LastModified>
<ETag>"2f3611d63139e7568d5680b1ae162a57"</ETag>
<Size>29144</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
...
</ListBucketResult>

Incidentally, following any of the links to the config_LANG.json files will reveal the two API keys you need (gigyaProd and wiredProd). Yup, that's in plain text via Renault's own S3 domain. :man_facepalming:

I've now published my code at https://github.com/jamesremuscat/pyze.

jamesremuscat avatar Jul 24 '19 16:07 jamesremuscat

@epenet I Have this error with your script ...

File "MyRenault.py", line 9 async def get_android_config(session, location): ^ SyntaxError: invalid syntax

Do you have any idea ?

Merci et bon Week-end.

TheReiner avatar Jul 26 '19 20:07 TheReiner

@TheReiner Likely you tried it with python2. Try with python3 .

zeenix avatar Jul 27 '19 16:07 zeenix

@zeenix Thanks :) But i have a new error :-(

python3 MyRenault.py

Traceback (most recent call last): File "MyRenault.py", line 185, in loop.run_until_complete(main()) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "MyRenault.py", line 111, in main await mainwithsession(session) File "MyRenault.py", line 122, in mainwithsession in_file = open('android_config.json', 'r') FileNotFoundError: [Errno 2] No such file or directory: 'android_config.json'

TheReiner avatar Jul 28 '19 10:07 TheReiner

@zeenix Thanks :) But i have a new error :-(

python3 MyRenault.py

Traceback (most recent call last): File "MyRenault.py", line 185, in loop.run_until_complete(main()) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "MyRenault.py", line 111, in main await mainwithsession(session) File "MyRenault.py", line 122, in mainwithsession in_file = open('android_config.json', 'r') FileNotFoundError: [Errno 2] No such file or directory: 'android_config.json'

Same issue, I created an android_condig.json file. But after I have json decode issue....

LacazeThomas avatar Jul 28 '19 16:07 LacazeThomas

@LacazeThomas, @TheReiner,

I've just now tweaked the code so that it grabs the "android_config.json" from the renault website (on AWS). It should work better for you now.

epenet avatar Jul 29 '19 07:07 epenet

Thank you, it's awesome. I use your script with Prometheus and this is what I'm resulting grafana zoe

LacazeThomas avatar Jul 29 '19 19:07 LacazeThomas

@epenet Thanks :) It's Work fine :)

{'data': {'type': 'Car', 'id': 'XXXXXXXXXX', 'attributes': {'lastUpdateTime': '2019-07-29T17:00:50Z', 'batteryTemperature': 27, 'plugStatus': 0, 'chargeStatus': -1, 'batteryLevel': 76, 'rangeHvacOff': 240}}}

Do you think it is possible to recover the odometer of the car ?

TheReiner avatar Jul 29 '19 20:07 TheReiner

The odometer is given by the /cockpit call, but it does not work for all cars. It does not for my Q210. See muscat's blog

yoh-there avatar Jul 31 '19 12:07 yoh-there

home

I created a small iobroker-Adapter for the old API: https://github.com/fungus75/ioBroker.zoe ==> Worked quite nice just up to last week. Looks like Austria switched than to the new App. Currently I'm trying to get my car linked to the new App (still allways getting: "Code is invalid"). After that I'm going to try to adjust the iobroker-Adapter to the new API.

fungus75 avatar Nov 27 '19 20:11 fungus75