Betatest - Renault ZE Services Binding

@Doug_Culnane
Tried to use the Zoe Binding in OH3.2

I do get
Status:OFFLINE - Status:COMMUNICATION_ERROR

Status never gets online.
Is there anything I can do to debug?

and the following errors in the log:

2021-12-30 20:20:16.493 [WARN ] [ault.internal.handler.RenaultHandler] - Error My Renault Http Session.

java.lang.NullPointerException: null

at java.net.URLEncoder.encode(URLEncoder.java:224) ~[?:?]

at java.net.URLEncoder.encode(URLEncoder.java:196) ~[?:?]

at org.eclipse.jetty.client.util.FormContentProvider.encode(FormContentProvider.java:71) ~[bundleFile:9.4.43.v20210629]

at org.eclipse.jetty.client.util.FormContentProvider.convert(FormContentProvider.java:61) ~[bundleFile:9.4.43.v20210629]

at org.eclipse.jetty.client.util.FormContentProvider.(FormContentProvider.java:43) ~[bundleFile:9.4.43.v20210629]

at org.eclipse.jetty.client.util.FormContentProvider.(FormContentProvider.java:38) ~[bundleFile:9.4.43.v20210629]

at org.eclipse.jetty.client.HttpClient.FORM(HttpClient.java:407) ~[bundleFile:9.4.43.v20210629]

at org.eclipse.jetty.client.HttpClient.FORM(HttpClient.java:392) ~[bundleFile:9.4.43.v20210629]

at org.openhab.binding.renault.internal.api.MyRenaultHttpSession.getAccountInfo(MyRenaultHttpSession.java:112) ~[?:?]

at org.openhab.binding.renault.internal.api.MyRenaultHttpSession.initSesssion(MyRenaultHttpSession.java:70) ~[?:?]

at org.openhab.binding.renault.internal.handler.RenaultHandler.getStatus(RenaultHandler.java:127) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

Hi @chrode

Thanks for the error report.

Looking at the code and error I guess either the: GigyaApiKey or cookieValue is null.

The gigyaRootUrl has a default so it should be OK.

The cookieValue is got from a previous request. If successful and the logger is set to debug then this line should work and put the value in the log file.
logger.debug(“Cookie: {}”, cookieValue);

If you have debug logs and no errors then I will need to examine the response that you are getting. This might require a debug version for you to install and you would need to send me the logs with private information scrambled
 Let me know if this is something you can do?

@Doug_Culnane

Yes, fine - anything that could help to make the binding working. Could you send me a download link for the debug version of the binding?

@chrode

Here is a link to a version (with an old version number) that should help us debug the reason the binding can not collect your cookie

https://drive.google.com/file/d/1mB-bedCskaSLudldtQnGTEuB3un7WZsD/view?usp=sharing

Remove the Renault binding. Put the linked one in the addons folder and configure the thing. Please post the log (or email it to me doug at culnane do net) of the binding connecting here with any personal information removed. What I think I need is the line from the log: “Login Error: cookie value not found! Response:
”

You will need to remove this version from the add-ons folder later


@Doug_Culnane

Thank You Doug, can not explain it - but with the downloaded binding the car was immediately online.
Switched back to the Renault binding that comes with 3.2 and it is also online.

@chrode OK looks like there is some instability (or inconsistencies) in the Renault services
 Thanks for the feedback and I am glad it is working. If you get some errors let me have the log entries and I can try to improve the handling of the error cases.

1 Like

Dear @Doug_Culnane ,

many thanks for providing this binding. Just installed it for our 2020 Zoe in Germany. Location seems not to be available, but the responses show a few data that could also be useful channels from my point of view.

  • hvacStatus also delivers the external temparature.
  • battery response also delivers an attribute batteryAutonomy which looks like as it could be the remaining estimated mileage. Also plugStatus and chargingStatus look interesting.

Do you have any plans to also add them as channels?

Yours sincerely

Wolfgang

@Wolfgang1966

Great Idea. I will add them.

externalTemparature
estimatedRange (batteryAutonomy)
plugStatus
chargingStatus

Thanks,

Doug

@Wolfgang1966

I have got the new channels working.

Maybe you could test it?:
https://drive.google.com/file/d/1obCAOcyMfT5Lph9w17FbhCZNAtMLYfxb/view?usp=sharing

I am not getting the externalTemperature! Maybe this only works when the HVAC is on???

To get this merged I need to make an issue. Maybe you could create a new issue and I will then use this as the reference for the pull request.

Thanks.

1 Like

Hi there,

I could test these new channels and I am getting the externalTemperature (not right away at first update but it did update overnight, not sure why this was delayed)
Also I was wondering if the external temperature velue is really accurate because it reports negative values (as it was cold outside here) but the car is warmly parked into our garage at about 7°C, could it be based on the location temperature ? or is just calibrated with an offset ?

I also have detected an issue with chargingStatus, the value reported is “CHARGE_ERROR” when unplugged/not charging. I was expecting the value “NOT_CHARGING”. I guess the binding is getting this value from the server, does everyone get this as well ?
This might be linked to the way I end the charging because I usually interrupt charging session by open the front trap and then unplug the cord when I reach 80%. Maybe I will try with switching off the wall charger instead


thanks

1 Like

Hi Loyd,

Thanks for testing.

It looks to me like the externalTemperature is just going to create confusion and Bug reports so I will remove it before submitting a pull request. I have never got a value from this in my testing.

chargingStatus delivers a decimal number (!???). I use the info from this python code to map to a human readable text:

It seams to work for me. I stop my changing using a call to my go-e charger that then stops the charging process. Maybe killing the power causes a error state for a while.

Thanks again for testing. More testing would help so I do not publish code that only works on my computer / car / charger


I will try to find the time to test it with my PH2.

Unfortunately I still rely on this

as I am using the values in my rules.

I have to fetch the data from my website through http, so a native binding would be a real benefit:+1:
Thx for you ongoing work, really appreciate it.

Edit:

It looks like this only works for PH1. It never showed up on my PH2, so it was removed from my currently used php version as well.

1 Like

Finished.

All available channels get populated with the correct data (except of course external temperature).
ZOE R110/50 Experience 10/2020, openHAB 3.2 release version.

As the “HVAC Status” label implies I guess it is only possible to get the status of HVAC, but I cannot switch it ON through that channel?

Unfortunately I need that feature (HVAC is switched ON through iCalender Binding in my openHAB setup), so I will have to rely on my old script.

Thx for your ongoing work.

1 Like

Dear @Doug_Culnane ,

thanks for your patience, it was a busy week so I was not able to test the binding earlier.

For our Zoe which is parked since yesterday evening, I just got the following response (in the logs):

{"data":{"type":"Car","id":"VF1AGVYF060XXXXXX","attributes":{"externalTemperature":-4.0,"hvacStatus":"off"}}}

So at least here hvacStatus is of and the value is still delivered.

Car is parking outside, so the value looks correct to me. It could be that this is the last value the car sent to the Renault servers. If the cell network connectivity in the Garage is poor, it might simply be not able to send the values. Or, if the car “falls asleep” after parking, it may not send values until it is woken up again. So I would be glad if you could keep the value and maybe add to the documentation that this is the latest temperature value the car reported to the Renault servers. Basically, the same is true for all other values too, so e.g. battery status may also be not the same that you would see inside the car. For the battery data, the API delivers a timestamp showing when the values were reported:

{"data":{"type":"Car","id":"VF1AGVYF060XXXXXX","attributes":{"timestamp":"2022-01-15T08:52:53+01:00","batteryLevel":46,"batteryTemperature":
0,"batteryAutonomy":90,"batteryCapacity":0,"batteryAvailableEnergy":0,"plugStatus":0,"chargingStatus":-1.0}}}

(The log was from 10:09, so more than 1h later). This is the same date that is also shown in the MyRenault app, so maybe it would be a good candidate for a channel also?

Yours sincerely

Wolfgang

@sihui and @Wolfgang1966 Thanks for awesome feedback.

RE: ExternalTemperatue. I am happy to keep it but I think I need to document that some stuff does not work on some cars. Location does not work on some cars and ExternalTemperatue is even more not working
 So I think keeping the channels and trying to document and log.warn() once about the not working stuff will be the plan.

RE: HVAC status. This is read only at the moment. I think I can send a post to turn it on but the car uses schedules and programs etc
 and I did not understand it or have the patience to work it out. @sihui if you can explain how this works in your scripts I can change this to a R/W attribute. This would be awesome because you could have a automated control or get up and manually turn on the HVAC while having breakfast


I am not a programmer unfortunately, but the part thats starts the HVAC is labeled “acnow” in the code. I thinks this part executes that command:

//Evaluate parameter "acnow" for preconditioning
if ($cmd_acnow === TRUE) {
  $postData = array(
    'Content-type: application/vnd.api+json',
    'apikey: '.$kamereon_api,
    'x-gigya-id_token: '.$session[1]
  );
  $jsonData = '{"data":{"type":"HvacStart","attributes":{"action":"start","targetTemperature":"21"}}}';
  $ch = curl_init('https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/'.$session[2].'/kamereon/kca/car-adapter/v1/cars/'.$vin.'/actions/hvac-start?country='.$country);
  curl_setopt($ch, CURLOPT_POST, TRUE);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $postData);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
  $response = curl_exec($ch);
  if ($response === FALSE) die(curl_error($ch));
}

Yes, that is how I use it: my wife is shift worker and I put her work schedule in my calender and the car is warm/cool when she starts/ends work :smiley:

1 Like

Thanks @sihui

Does this mean there is no Schedule Programs in the car (MyRenault App) you just say (or your automations says) “ON now”. This is perfect as it makes the control easy. I will try to implement this and get it working in the binding making the HVAC switch a read write channel.

Do you think the targetTemperature should be a configuration option or a channel? I would say configuration item because you set and forget. However maybe others think this is something they want to automate???

I will post a new version for testing once I think I have it working.

Correct, not a single one.

Just a fixed value as cars with manual ac only use that.

Awesome :grinning:

1 Like

Here is an updated binding with more channels and HVAC switch now able to start pre-conditioning thanks to @sihui

https://drive.google.com/file/d/14onyNJA_TqYOQr0dYz6bPmChPioS4rS1/view?usp=sharing

You can set your target temperature using a channel value and switch on the HVAC. (The cancel (HVAC OFF /CANCEL) does not seam to work). If anyone has a working AC_OFF http example please let me know what it looks like.

There is a README.md here detailing the channels: openhab-addons/bundles/org.openhab.binding.renault at renault-more-channels · dougculnane/openhab-addons · GitHub

Please test and give me feedback. Not all channels work on my car but they might on yours?

1 Like

I don’t think this is possible, have not heard of that. As we know the ac stops after 10 min, should be sufficient.
Will test later today, thx a lot.

1 Like