send Problem evt behoben
This commit is contained in:
@@ -75,7 +75,7 @@ class Belevo_Server_Kommunikation extends IPSModule
|
|||||||
throw new Exception("Invalid action");
|
throw new Exception("Invalid action");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public function GetAction() {
|
public function GetAction() {
|
||||||
$json = $this->MakeJson();
|
$json = $this->MakeJson();
|
||||||
//$baseURL = $this->ReadPropertyString("BaseURL");
|
//$baseURL = $this->ReadPropertyString("BaseURL");
|
||||||
@@ -92,6 +92,14 @@ class Belevo_Server_Kommunikation extends IPSModule
|
|||||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Keine Aufzeichnung im Influx: Anlagenummer oder JSON-Daten fehlen->GetAction()");
|
IPS_LogMessage("Belevo_Server_Kommunikation", "Keine Aufzeichnung im Influx: Anlagenummer oder JSON-Daten fehlen->GetAction()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public function GetAction() {
|
||||||
|
$url = "http://192.168.20.140:5000/influx?id=test&E_PNB_5M_0=1000";
|
||||||
|
IPS_LogMessage("Belevo_Server_Kommunikation", "Sende Anfrage an URL: ".$url);
|
||||||
|
$this->SendJsonToInfluxDB($url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function MakeJson() {
|
public function MakeJson() {
|
||||||
@@ -128,7 +136,7 @@ return $json;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private function SendJsonToInfluxDB($url, $json)
|
private function SendJsonToInfluxDB($url, $json)
|
||||||
{
|
{
|
||||||
// Header für die Anfrage definieren
|
// Header für die Anfrage definieren
|
||||||
@@ -157,6 +165,34 @@ return $json;
|
|||||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Daten erfolgreich an Influx gesendet->SendJsonToInfluxDB()");
|
IPS_LogMessage("Belevo_Server_Kommunikation", "Daten erfolgreich an Influx gesendet->SendJsonToInfluxDB()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
private function SendJsonToInfluxDB($url)
|
||||||
|
{
|
||||||
|
// cURL Initialisieren
|
||||||
|
$curl = curl_init();
|
||||||
|
|
||||||
|
// Optionen für cURL-Request definieren
|
||||||
|
// Nur die erforderlichen Optionen setzen
|
||||||
|
curl_setopt_array($curl, [
|
||||||
|
CURLOPT_URL => $url,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// cURL-Request ausführen
|
||||||
|
$result = curl_exec($curl);
|
||||||
|
$error = curl_error($curl);
|
||||||
|
|
||||||
|
// cURL beenden
|
||||||
|
curl_close($curl);
|
||||||
|
|
||||||
|
// Logging der Antwort und eventueller Fehler
|
||||||
|
if ($error) {
|
||||||
|
IPS_LogMessage("Belevo_Server_Kommunikation", "Fehler beim Senden an Influx: " . $error);
|
||||||
|
} else {
|
||||||
|
IPS_LogMessage("Belevo_Server_Kommunikation", "Antwort von Influx: " . $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "7.1"
|
"version": "7.1"
|
||||||
},
|
},
|
||||||
"version": "0.63",
|
"version": "0.64",
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"date": 0
|
"date": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user