diff --git a/Ladestation_Universal/module.php b/Ladestation_Universal/module.php index 016efda..e502654 100644 --- a/Ladestation_Universal/module.php +++ b/Ladestation_Universal/module.php @@ -32,6 +32,7 @@ public function Create() { $this->RegisterVariableBoolean("Solarladen", "Solarladen", "~Switch", 11); $this->RegisterVariableInteger("Fahrzeugstatus", "Fahrzeugstatus", "", 0); $this->RegisterVariableInteger("Lademodus", "Lademodus", "", 0); + $this->RegisterVariableFloat("Ladeleistung_Effektiv", "Ladeleistung_Effektiv", "", 0); @@ -158,7 +159,7 @@ public function GetCurrentData(bool $Peak) { $ch = curl_init(); // Setze die URL - curl_setopt($ch, CURLOPT_URL, "http://" . $this->ReadPropertyString("IP_Adresse") . "/mqtt?payload="); + curl_setopt($ch, CURLOPT_URL, "http://" . $this->ReadPropertyString("IP_Adresse") . "/api/status"); // Setze die Option, die Antwort als String zurückzugeben curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @@ -177,6 +178,10 @@ public function GetCurrentData(bool $Peak) { // Überprüfe, ob das JSON-Dekodieren erfolgreich war und der Schlüssel "car" existiert if (json_last_error() === JSON_ERROR_NONE && isset($data['car'])) { // Speichere den Wert von "car" in der Variable $status + + + SetValue($this->GetIDForIdent("Ladeleistung_Effektiv"), $data['tpa']); + SetValue($this->GetIDForIdent("Fahrzeugstatus"), $data['car']); @@ -229,7 +234,7 @@ public function GetCurrentData(bool $Peak) { public function sendPowerToStation($value) { // Base URL - $baseUrl = "http://" . $this->ReadPropertyString("IP_Adresse") . "/mqtt?payload="; + $baseUrl = "http://" . $this->ReadPropertyString("IP_Adresse") . "/api/set?"; IPS_LogMessage("Ladestation", "Aufgerufene ip" . $baseUrl); $value = $this->convertPowerToCurrent($value, GetValue($this->GetIDForIdent("Lademodus"))); // Initialize a cURL session @@ -237,7 +242,7 @@ public function sendPowerToStation($value) { // If value is 0, make a single request if ($value == 0) { - $url = $baseUrl . "alw=0"; + $url = $baseUrl . "frc=1"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); @@ -248,7 +253,7 @@ public function sendPowerToStation($value) { // For value between 1 and 32, make two requests else if ($value >= 1 && $value <= 32) { // First request - $url1 = $baseUrl . "alw=1"; + $url1 = $baseUrl . "frc=2"; curl_setopt($ch, CURLOPT_URL, $url1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response1 = curl_exec($ch); diff --git a/library.json b/library.json index 3be606a..535252e 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "0.19", + "version": "0.20", "build": 0, "date": 0 } \ No newline at end of file