Dummy-Ladestation hinzugefügt

This commit is contained in:
2025-02-19 15:36:34 +01:00
parent db23631c7e
commit 2225dc8860
3 changed files with 52 additions and 6 deletions

View File

@@ -182,12 +182,28 @@ class Ladestation_Universal extends IPSModule
CURLOPT_URL,
"http://" . $this->ReadPropertyString("IP_Adresse") . "/api/status"
);
// Setze die Option, die Antwort als String zurückzugeben
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Führe die Anfrage aus und speichere die Antwort
$response = curl_exec($ch);
// Schließe cURL
curl_close($ch);
}elseif($this->ReadPropertyInteger("Ladestation")==1){
curl_setopt(
$ch,
CURLOPT_URL,
"http://" . $this->ReadPropertyString("IP_Adresse") . "/mqtt?payload="
);
// Setze die Option, die Antwort als String zurückzugeben
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Führe die Anfrage aus und speichere die Antwort
$response = curl_exec($ch);
// Schließe cURL
curl_close($ch);
}
elseif($this->ReadPropertyInteger("Ladestation")==3){
curl_setopt(
@@ -197,10 +213,7 @@ class Ladestation_Universal extends IPSModule
);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $this->ReadPropertyString("Username") . ":" . $this->ReadPropertyString("Password"));
}
// Setze die Option, die Antwort als String zurückzugeben
// Setze die Option, die Antwort als String zurückzugeben
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Führe die Anfrage aus und speichere die Antwort
@@ -208,6 +221,15 @@ class Ladestation_Universal extends IPSModule
// Schließe cURL
curl_close($ch);
}
elseif($this->ReadPropertyInteger("Ladestation")==4){
$response = true;
}
// Überprüfe, ob die Antwort nicht leer ist
if ($response) {
@@ -257,6 +279,20 @@ class Ladestation_Universal extends IPSModule
}
}
}
if($this->ReadPropertyInteger("Ladestation")==4){
// Überprüfe, ob das JSON-Dekodieren erfolgreich war und der Schlüssel "car" existiert
SetValue(
$this->GetIDForIdent("Ladeleistung_Effektiv"),
GetValue("Ladeleistung")
);
}
}
@@ -381,7 +417,11 @@ class Ladestation_Universal extends IPSModule
}elseif($this->ReadPropertyInteger("Ladestation")==3){
// Nichts zu tun für Smart-Me station
} }elseif($this->ReadPropertyInteger("Ladestation")==4){
// Nichts zu tun für Dummy station
}
// Second request
@@ -449,7 +489,9 @@ class Ladestation_Universal extends IPSModule
// Return responses
return;
}
}elseif($this->ReadPropertyInteger("Ladestation")==4){
// Nichts zu tun für Dummy station
}
}