Server Kommunilation
Influx verbindung ergänzt LodMessage hinzugefügt
This commit is contained in:
@@ -83,9 +83,9 @@ class Belevo_Server_Kommunikation extends IPSModule
|
||||
// Kombiniere die URL mit der Anlagenummer
|
||||
$fullURL = $baseURL . $anlagenummer;
|
||||
$this->SendJsonToInfluxDB($fullURL, $json);
|
||||
echo "Aufzeichnung im Influx";
|
||||
|
||||
} else {
|
||||
echo "Keine Aufzeichnung im Influx";
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Keine Aufzeichnung im Influx");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,10 +106,13 @@ $this->SetValue("E_PNB_5M_0", $netzbezug);
|
||||
|
||||
// Werte in ein Array packen
|
||||
$data = [
|
||||
"_measurement" => $this->ReadPropertyString("Anlagenummer"),
|
||||
"_field" =>[
|
||||
//"G_BT_5M_0" => $this->GetValue("G_BT_5M_0"),
|
||||
//"G_SK_5M_3" => $this->GetValue("G_SK_5M_3"),
|
||||
//"G_SK_5M_4" => $this->GetValue("G_SK_5M_4"),
|
||||
"E_PNB_5M_0" => $this->GetValue("E_PNB_5M_0"),
|
||||
]
|
||||
];
|
||||
|
||||
// Array in JSON konvertieren
|
||||
@@ -123,9 +126,11 @@ return $json;
|
||||
|
||||
private function SendJsonToInfluxDB($url, $json)
|
||||
{
|
||||
$token = "iFNTONC5UvST8GT5itWqxiO6m4O1yHt5hus54J8eqotk5IZiq0Wjd0_Xi6dozmo32QR3esJqk6hJAvJ8X2SxtQ==";
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json\r\n",
|
||||
'header' => "Content-Type: application/json\r\n".
|
||||
"Authorization: Bearer $token\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => $json,
|
||||
],
|
||||
@@ -135,9 +140,9 @@ return $json;
|
||||
|
||||
if ($result === FALSE) {
|
||||
|
||||
echo "Fehler beim Senden der Daten an InfluxDB.";
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Fehler beim senden an Influx");
|
||||
} else {
|
||||
echo "Daten erfolgreich an InfluxDB gesendet.";
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Daten erfolgreich an Influx gesendet");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"compatibility": {
|
||||
"version": "7.1"
|
||||
},
|
||||
"version": "0.32",
|
||||
"version": "0.33",
|
||||
"build": 0,
|
||||
"date": 0
|
||||
}
|
||||
Reference in New Issue
Block a user