From 0ed1cb0a71e879991332c4e044fc5a56c52fce03 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Mon, 4 Nov 2024 15:13:19 +0100 Subject: [PATCH] verbessert, evt --- Belevo_Server_Kommunikation/module.php | 35 +++----------------------- library.json | 2 +- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/Belevo_Server_Kommunikation/module.php b/Belevo_Server_Kommunikation/module.php index 15ac43c..6642974 100644 --- a/Belevo_Server_Kommunikation/module.php +++ b/Belevo_Server_Kommunikation/module.php @@ -130,45 +130,18 @@ return $json; private function SendJsonToInfluxDB($url, $json) { - // $token = "Token iFNTONC5UvST8GT5itWqxiO6m4O1yHt5hus54J8eqotk5IZiq0Wjd0_Xi6dozmo32QR3esJqk6hJAvJ8X2SxtQ=="; - /* - if (empty($token)) { - IPS_LogMessage("Belevo_Server_Kommunikation", "InfluxDB-Token fehlt->SendJsonToInfluxDB"); - return; - }*/ /* - - - + // Header für die Anfrage definieren $headers = [ "Content-Type: application/json", - //"Authorization: Bearer $token" // Wenn der Token gebraucht wird, füge ihn hier hinzu + "id: test" // Die ID, die vom Flask-Server überprüft wird ]; + // Optionen für den HTTP-Request definieren $options = [ 'http' => [ 'header' => implode("\r\n", $headers), 'method' => 'POST', - 'content' => $json, // Hier wird das JSON im Body gesendet - ], - ]; - */ - - -/* - $options = [ - 'http' => [ - 'header' => "Content-Type: application/json\r\n", - 'method' => 'POST', - 'content' => $json - ], -];*/ - - $options = [ - 'http' => [ - 'header' => "Content-Type: application/json\r\n". - "id: test\r\n", - 'method' => 'POST', - + 'content' => $json // JSON-Inhalt im Body der Anfrage ], ]; IPS_LogMessage("Belevo_Server_Kommunikation", "Options: " . print_r($options, true)); diff --git a/library.json b/library.json index 471d27f..2087c29 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "0.60", + "version": "0.61", "build": 0, "date": 0 } \ No newline at end of file