Get Data from Renault My ZE Online

In January 2016 Renault changed theyr e-car portal finally to a json API version. Now you can login to get a token and then request data about your Zero Emission Car. Here is an example flow who requests the Battery stats. Sorry for the German texts in the flow but you'll be easy able to figure out how to change them.

[{"id":"88f5ae81.3d8df8","type":"ui_tab","name":"Home","icon":"dashboard","order":"1"},{"id":"a7141545.36353","type":"inject","z":"fecf0569.4adad8","name":"every hour","topic":"","payload":"","payloadType":"none","repeat":"3600","crontab":"","once":true,"x":138,"y":55,"wires":[["f9bbdd37.1052b"]]},{"id":"81d077e8.d4993","type":"http request","z":"fecf0569.4adad8","name":"","method":"POST","ret":"obj","url":"https://www.services.renault-ze.com/api/user/login","x":517,"y":55,"wires":[["865fb89.8f11bc8","c200c526.960ea"]]},{"id":"865fb89.8f11bc8","type":"debug","z":"fecf0569.4adad8","name":"","active":false,"console":"false","complete":"false","x":766,"y":51,"wires":[]},{"id":"f9bbdd37.1052b","type":"function","z":"fecf0569.4adad8","name":"login request","func":"msg.headers = {\"Content-Type\":\"application/json;charset=utf-8\"}\nmsg.payload = {\"username\":\"Username\",\"password\":\"Password\"}\n\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":56,"wires":[["81d077e8.d4993"]]},{"id":"c200c526.960ea","type":"function","z":"fecf0569.4adad8","name":"battery stats","func":"token = msg.payload.token;\nrefresh_token = msg.payload.refresh_token;\n\nvin = msg.payload.user.vehicle_details.VIN;\n\nmsg.url = \"https://www.services.renault-ze.com/api/vehicle/\" + vin + \"/battery\";\nmsg.headers = {\"Authorization\": \"Bearer \" + token};\nmsg.payload = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":301,"y":157,"wires":[["5484869b.b54ab","ad288d6e.e11808","14be5617.56cc52"]]},{"id":"14be5617.56cc52","type":"http request","z":"fecf0569.4adad8","name":"","method":"GET","ret":"obj","url":"","x":516,"y":161,"wires":[["da844948.1e4af","7923c02f.9f6f28","bbd04d3.7b55eb","4d58211c.31efb8","e759c4be.d560a8","d3fcff23.66184"]]},{"id":"ad288d6e.e11808","type":"debug","z":"fecf0569.4adad8","name":"","active":false,"console":"false","complete":"headers","x":515,"y":260,"wires":[]},{"id":"5484869b.b54ab","type":"debug","z":"fecf0569.4adad8","name":"","active":false,"console":"false","complete":"url","x":498,"y":213,"wires":[]},{"id":"da844948.1e4af","type":"debug","z":"fecf0569.4adad8","name":"","active":false,"console":"false","complete":"false","x":760,"y":167,"wires":[]},{"id":"81d714de.0e7208","type":"ui_text","z":"fecf0569.4adad8","tab":"88f5ae81.3d8df8","name":"L├Ądt: ","group":"ZOE Status","order":1,"format":"{{msg.payload.charging}}","x":981,"y":212,"wires":[]},{"id":"e8d50ee.92e27f","type":"ui_text","z":"fecf0569.4adad8","tab":"88f5ae81.3d8df8","name":"Kabel: ","group":"ZOE Status","order":1,"format":"{{msg.payload.plugged}}","x":983,"y":257,"wires":[]},{"id":"7923c02f.9f6f28","type":"ui_text","z":"fecf0569.4adad8","tab":"88f5ae81.3d8df8","name":"Ladestand: ","group":"ZOE Status","order":1,"format":"{{msg.payload.charge_level}} %","x":757,"y":296,"wires":[]},{"id":"bbd04d3.7b55eb","type":"ui_text","z":"fecf0569.4adad8","tab":"88f5ae81.3d8df8","name":"Reichweite: ","group":"ZOE Status","order":1,"format":"{{msg.payload.remaining_range}} km","x":759,"y":338,"wires":[]},{"id":"4d58211c.31efb8","type":"function","z":"fecf0569.4adad8","name":"translate","func":"if (msg.payload.plugged == true) {\n    msg.payload.plugged = \"Angeschlossen\";\n} else {\n    msg.payload.plugged = \"Entfernt\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":746,"y":256,"wires":[["e8d50ee.92e27f"]]},{"id":"e759c4be.d560a8","type":"function","z":"fecf0569.4adad8","name":"translate","func":"if (msg.payload.charging == true) {\n    msg.payload.charging = \"Ja\";\n} else {\n    msg.payload.charging = \"Nein\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":745,"y":212,"wires":[["81d714de.0e7208"]]},{"id":"5845a75d.1283c","type":"moment","z":"fecf0569.4adad8","name":"","topic":"","input":"payload","format":"fromNow","output":"payload","x":900,"y":404,"wires":[["96377cb0.9305"]]},{"id":"96377cb0.9305","type":"ui_text","z":"fecf0569.4adad8","tab":"88f5ae81.3d8df8","name":"Aktuallisiert:","group":"ZOE Status","order":1,"format":"{{msg.payload}}","x":1114,"y":405,"wires":[]},{"id":"d3fcff23.66184","type":"function","z":"fecf0569.4adad8","name":"translate","func":"msg.payload = msg.payload.last_update\nreturn msg;","outputs":1,"noerr":0,"x":709,"y":404,"wires":[["5845a75d.1283c"]]}]
roadfox

Flow Info

created 1 year, 9 months ago

Node Types

Core
  • debug (x4)
  • function (x5)
  • http request (x2)
  • inject (x1)
Other
  • moment (x1)
  • ui_tab (x1)
  • ui_text (x5)

Tags

  • sign-in
  • token
  • json
  • api
  • renault
  • ze
  • zoe
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option