no message
This commit is contained in:
@@ -346,12 +346,32 @@ class Ladestation_v2 extends IPSModule
|
|||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
$ch = curl_init();
|
||||||
|
|
||||||
if ($response === false) {
|
$url2 = "https://api.easee.com/api/chargers/".$this->ReadPropertyString("Seriennummer")."/state";
|
||||||
IPS_LogMessage("Ladestation", "Fehler beim Abrufen der eCarUp API-Daten");
|
curl_setopt_array($ch, [
|
||||||
|
CURLOPT_ENCODING => "",
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 30,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => "GET",
|
||||||
|
CURLOPT_HTTPHEADER => [
|
||||||
|
"Authorization: Bearer ".GetValue($this->ReadPropertyInteger("Token_Easee"))."",
|
||||||
|
"content-type: application/*+json"
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url1);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
$response_easee = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false || $response_easee === false) {
|
||||||
|
IPS_LogMessage("Ladestation", "Fehler beim Abrufen der API-Daten");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$easee_data = json_decode($response_easee, true);
|
||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
IPS_LogMessage("Ladestation", "Fehler beim Dekodieren der JSON-Antwort");
|
IPS_LogMessage("Ladestation", "Fehler beim Dekodieren der JSON-Antwort");
|
||||||
@@ -359,6 +379,15 @@ class Ladestation_v2 extends IPSModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['driverIdentifier']) && ($data['driverIdentifier']==$this->ReadPropertyString("Username"))) {
|
if (isset($data['driverIdentifier']) && ($data['driverIdentifier']==$this->ReadPropertyString("Username"))) {
|
||||||
|
if(isset($easee_data['totalPower'])){
|
||||||
|
|
||||||
|
$this->SetValue("Ladeleistung_Effektiv", $easee_data['totalPower']);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$this->SetValue("Ladeleistung_Effektiv", 0);
|
||||||
|
|
||||||
|
}
|
||||||
$this->SetValue("Ladeleistung_Effektiv", $this->GetValue("Power"));
|
$this->SetValue("Ladeleistung_Effektiv", $this->GetValue("Power"));
|
||||||
$this->SetValue("Fahrzeugstatus", 2);
|
$this->SetValue("Fahrzeugstatus", 2);
|
||||||
$car_on_station = true;
|
$car_on_station = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user