no message

This commit is contained in:
2025-06-17 16:23:07 +02:00
parent 597b7d6e6f
commit 975f94582a

View File

@@ -346,12 +346,32 @@ class Ladestation_v2 extends IPSModule
$response = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
$url2 = "https://api.easee.com/api/chargers/".$this->ReadPropertyString("Seriennummer")."/state";
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) {
IPS_LogMessage("Ladestation", "Fehler beim Abrufen der eCarUp API-Daten");
if ($response === false || $response_easee === false) {
IPS_LogMessage("Ladestation", "Fehler beim Abrufen der API-Daten");
return;
}
$easee_data = json_decode($response_easee, true);
$data = json_decode($response, true);
if (json_last_error() !== JSON_ERROR_NONE) {
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($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("Fahrzeugstatus", 2);
$car_on_station = true;