Dummy-Ladestation hinzugefügt

This commit is contained in:
dh
2025-02-19 15:36:34 +01:00
parent db23631c7e
commit 2225dc8860
3 changed files with 52 additions and 6 deletions
+4
View File
@@ -16,6 +16,10 @@
{ {
"caption": "Smart-Me Pico", "caption": "Smart-Me Pico",
"value": 3 "value": 3
},
{
"caption": "Dummy Station (Ohne Ansteuerung)",
"value": 4
} }
] ]
}, },
+47 -5
View File
@@ -182,12 +182,28 @@ class Ladestation_Universal extends IPSModule
CURLOPT_URL, CURLOPT_URL,
"http://" . $this->ReadPropertyString("IP_Adresse") . "/api/status" "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){ }elseif($this->ReadPropertyInteger("Ladestation")==1){
curl_setopt( curl_setopt(
$ch, $ch,
CURLOPT_URL, CURLOPT_URL,
"http://" . $this->ReadPropertyString("IP_Adresse") . "/mqtt?payload=" "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){ elseif($this->ReadPropertyInteger("Ladestation")==3){
curl_setopt( curl_setopt(
@@ -197,10 +213,7 @@ class Ladestation_Universal extends IPSModule
); );
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $this->ReadPropertyString("Username") . ":" . $this->ReadPropertyString("Password")); 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); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Führe die Anfrage aus und speichere die Antwort // Führe die Anfrage aus und speichere die Antwort
@@ -208,6 +221,15 @@ class Ladestation_Universal extends IPSModule
// Schließe cURL // Schließe cURL
curl_close($ch); curl_close($ch);
}
elseif($this->ReadPropertyInteger("Ladestation")==4){
$response = true;
}
// Überprüfe, ob die Antwort nicht leer ist // Überprüfe, ob die Antwort nicht leer ist
if ($response) { 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){ }elseif($this->ReadPropertyInteger("Ladestation")==3){
// Nichts zu tun für Smart-Me station // Nichts zu tun für Smart-Me station
} }elseif($this->ReadPropertyInteger("Ladestation")==4){
// Nichts zu tun für Dummy station
} }
// Second request // Second request
@@ -449,7 +489,9 @@ class Ladestation_Universal extends IPSModule
// Return responses // Return responses
return; return;
} }elseif($this->ReadPropertyInteger("Ladestation")==4){
// Nichts zu tun für Dummy station
}
} }
+1 -1
View File
@@ -6,7 +6,7 @@
"compatibility": { "compatibility": {
"version": "7.1" "version": "7.1"
}, },
"version": "1.040", "version": "1.042",
"build": 0, "build": 0,
"date": 0 "date": 0
} }