edent/Renault-Zoe-API

Little mistake in your docu

wolfijenne opened this issue · 7 comments

Precondition Now is also working with a POST request, not a GET.

edent commented

Please send a pull request 😁

Hi edent, this is really great stuff. I was also playing around with my own code for my Zoe and your charge command. Somehow, I have a feeling that the "get" does not work for issung the charge command. I always get an error message. Is it possible that I need to use a "POST" or "PUT" for issung the charge command? thanks,

edent commented

It's possible, yes. Try it and report back :-)

POST seems to connect me and provides a message, but I'm flying blind in what to post. "payload = {'charge':'true'}"?

no payload. Just the command as a post. See the js on the renault site:
For AC:
turnOn: function turnOn() { var baseURI = AppConstants.settings.apiUrl + "/vehicle/" + UserService.getLoggedUser().vehicle_details.VIN + "/air-conditioning"; return $http.post(baseURI).then(function (res) { $log.debug("AC turned on successfully"); return $q.resolve(res.data); });

Or for the charge command:
var baseURI = AppConstants.settings.apiUrl + "/vehicle/" + UserService.getLoggedUser().vehicle_details.VIN + "/battery"; return $http.get(baseURI).then(function (res) { };

askForStatus: function askForStatus() {
  var baseURI = AppConstants.settings.apiUrl + "/vehicle/" + UserService.getLoggedUser().vehicle_details.VIN + "/battery";
  return $http.post(baseURI).then(function (res) {
    $log.debug("Updated status asked successfully");

`
See the same command is used once with $http.get and once with $http.post and no payload. The get will just get the last value from the server, while the post will ask the zoe to measure the soc. But it works only while charging. To get the SOC actively, the charge now command can be used. It will fail (since not charged in), but the ZOE will send the actual SOC to the server some seconds later.

It works nicely with Post. It also accepts a Payload, but it seems does it does not have an impact. Thanks.

This issue can now be closed @edent after @DjMomo's #10 :)