edent / Renault-Zoe-API

A basic API for getting information about your Renault Zoe Electric Vehicle.
92 stars 24 forks source link

Request a new SOC measurement during charging #7

Open wolfijenne opened 6 years ago

wolfijenne commented 6 years ago

if you send the /battery request as a post request instead of get, it will ask the zoe to send its status to the server (like the refresh button in the app). But only during charging. It toke me quite some time in the renault JS code to figure that out.

wolfijenne commented 6 years ago

Meanwhile, I got further: The battery request (sent by post), is also undergoing the 20 Minutes check on the server side. So it does not much help. So what I have done now is to call each 5 minutes the /battery command by GET. If there is a new value available (timestamp comparsion), I save it to the database. If the charging flag is set, I also call in the script the /charge command by post. This then delivers each 5 minutes the SOC during charging. However, I had to switch off the notifications for the charging, since otherwise the server sends annoying error messages since the car is already charging... zoe_api The red lines are the calculated charge power during charging. Unfortunately not very well, what I found out is that the time stamp is the time stamp from the server side, not from the car, so if there is a delay, the derived values error is getting much bigger too.

Matthew1471 commented 6 years ago

The HTTP POST I believe sends a SMS text message to the car to update its status (you'll get an "Send SMS Error" when you request in the interface too many times). If the car is in a deep sleep I don't believe it can wake it up. An SMS text message is then sent to you on error confirming the car could not be woken up.

Pre-condition requests also fail during this deep sleep.

Normally the status of the vehicle updates on its own as I believe the data connection is used to send regular status updates (although it is possible these are 15 minute periodic SMS texts too). I haven't seen a scenario where requesting manual updates has given me any newer information.. but would be interested to know if you've seen any other than one condition manual requests would be useful...

I think there's a hint in the curious working of the official ZE website that states "New information is only available if the vehicle is charging and the last update was sent more than 20 minutes ago"

I suspect if the car is plugged in but not charging when the status update request is sent the car might not have gone into as much of a deep sleep, so plugged in but not charging could be a time (and I believe the only time) manual requests are useful.

wolfijenne commented 6 years ago

It seams they have changed something: Using the charge now command, I can at least get a bit more regulary some soc values. Also, my charging logic is waiting for low fare time before it starts charging. Sometimes (I did not figure out when this occurs), the car does not wake up for charging when the plugged in and the charging could start. So I monitor the charging current and if the charging does not start, I can send the charge now command to wake the car up. It's all a bit fuzzy :)