Because you are asking for more work I would like to give you some more information about the possibilites of my current used php script:
- I know that some people, who donāt have a smart charger, are using the built in car scheduler to turn off the charging at for example 80%. When the internal scheduler is switched off the car stops charging.
Maybe you can get the idea from the code snippet:
//Evaluate parameters "cmon" respectively "cmoff" for setting the chargemode
if ($cmd_cmon === TRUE || $cmd_cmoff === TRUE) {
$postData = array(
'Content-type: application/vnd.api+json',
'apikey: '.$kamereon_api,
'x-gigya-id_token: '.$session[1]
);
if ($cmd_cmon === TRUE) $jsonData = '{"data":{"type":"ChargeMode","attributes":{"action":"schedule_mode"}}}';
else $jsonData = '{"data":{"type":"ChargeMode","attributes":{"action":"always_charging"}}}';
$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/charge-mode?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));
}
- At least for PH2 it is possible to read the battery capacity (not sure if that is the correct part of the code, sorry):
echo '</TD></TR>'."\n".'<TR><TD>'.$lng['Battery level'].':</TD><TD>'.$session[12].' %</TD></TR>'."\n";
if ($mail_bl === 'Y' || $cmon_bl === 'Y' || !empty($exec_bl)) echo '<TR><TD>'.$lng['Action at battery level'].':</TD><TD><INPUT TYPE="number" NAME="bl" VALUE="'.$session[21].'" MIN="1" MAX="99"><INPUT TYPE="submit" VALUE="%"></TD></TR>'."\n";
if ($zoeph == 2) {
echo '<TR><TD>'.$lng['Battery capacity'].':</TD><TD>'.$session[13].' kWh</TD></TR>'."\n";
}
- It is possible to read the remaining time of a charging session:
$sendmessage = $lng['Specified battery level reached.']."\n".$lng['Battery level'].': '.$session[12].' %'."\n".$lng['Remaining charging time'].': '.$s.' '.$lng['minutes']."\n".$lng['Range'].': '.$session[14].' km'."\n".$lng['Status update'].': '.$session[8].' '.$session[9];
- It is possible to read the date and time of the last status update and position update (I could only find something about the position update):
//Request GPS position (only Ph2)
if ($zoeph == 2) {
$postData = array(
'apikey: '.$kamereon_api,
'x-gigya-id_token: '.$session[1]
);
$ch = curl_init('https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/'.$session[2].'/kamereon/kca/car-adapter/v1/cars/'.$vin.'/location?country='.$country);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $postData);
$response = curl_exec($ch);
if ($response === FALSE) die(curl_error($ch));
$responseData = json_decode($response, TRUE);
$s = date_create_from_format(DATE_ISO8601, $responseData['data']['attributes']['lastUpdateTime'], timezone_open('UTC'));
if (empty($s)) $update_sucess = FALSE;
else {
$s = date_timezone_set($s, timezone_open('Europe/Berlin'));
$session[17] = $responseData['data']['attributes']['gpsLatitude'];
$session[18] = $responseData['data']['attributes']['gpsLongitude'];
$session[19] = date_format($s, 'd.m.Y');
$session[20] = date_format($s, 'H:i');
}
}
Please dump those ideas if you are not interested or donāt have the time to work on it
Retrieving data from a website through http is a possibility, but a native openHAB binding is far better, of course.