From 975f94582afb799cab547ccba935ed5c9de00b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fliger?= Date: Tue, 17 Jun 2025 16:23:07 +0200 Subject: [PATCH] no message --- Ladestation_v2/module.php | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Ladestation_v2/module.php b/Ladestation_v2/module.php index bbcb155..4d5b3bd 100644 --- a/Ladestation_v2/module.php +++ b/Ladestation_v2/module.php @@ -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;