http vergessen
This commit is contained in:
@@ -39,7 +39,7 @@ class Belevo_Server_Kommunikation extends IPSModule
|
||||
$this->RegisterPropertyInteger("Aussentemperatur", 0);
|
||||
*/
|
||||
//$this->RegisterPropertyString("BaseURL","https://brain.belevo.ch/status?nr=");
|
||||
$this->RegisterPropertyString("BaseURL","192.168.20.140:5000/influx?nr=");
|
||||
$this->RegisterPropertyString("BaseURL","http://192.168.20.140:5000/influx?nr=");
|
||||
$this->RegisterPropertyString("Anlagenummer",0);
|
||||
$this->RegisterPropertyBoolean("InfluxJaNein", false);
|
||||
|
||||
@@ -94,26 +94,8 @@ class Belevo_Server_Kommunikation extends IPSModule
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public function GetAction() {
|
||||
$netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
||||
$url = "http://192.168.20.140:5000/influx?id=test&E_PNB_5M_0=".$netzbezug;
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Sende Anfrage an URL: ".$url);
|
||||
$this->SendJsonToInfluxDB($url);
|
||||
}*/
|
||||
|
||||
|
||||
public function MakeJson() {
|
||||
/*
|
||||
$boilertemperatur = $this->GetValue("Boilertemperatur");
|
||||
$this->SetValue("G_BT_5M_0", $boilertemperatur);
|
||||
|
||||
$kontaktTeillast = $this->GetValue("Kontakt_Teillast");
|
||||
$this->SetValue("G_SK_5M_3", $kontaktTeillast);
|
||||
|
||||
$kontaktVolllast = $this->GetValue("Kontakt_Volllast");
|
||||
$this->SetValue("G_SK_5M_4", $kontaktVolllast);
|
||||
*/
|
||||
$netzbezug = GetValue($this->ReadPropertyInteger("Netzbezug"));
|
||||
$an_nummer = GetProperty($this->ReadPropertyString("Anlagenummer");)
|
||||
$InfluxJaNein = $this->ReadPropertyBoolean("InfluxJaNein");
|
||||
@@ -129,9 +111,6 @@ $influxData = array(
|
||||
"Parameter" => array($an_nummer
|
||||
),
|
||||
"Tracker" =array(
|
||||
//"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" => $netzbezug
|
||||
)
|
||||
);
|
||||
@@ -144,36 +123,7 @@ return $json;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
private function SendJsonToInfluxDB($url, $json)
|
||||
{
|
||||
// Header für die Anfrage definieren
|
||||
$headers = [
|
||||
"Content-Type: application/json",
|
||||
"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 // JSON-Inhalt im Body der Anfrage
|
||||
],
|
||||
];
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Options: " . print_r($options, true));
|
||||
$context = stream_context_create($options);
|
||||
|
||||
$result = file_get_contents($url, false, $context);
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Result: " . print_r($result , true));
|
||||
if ($result === FALSE) {
|
||||
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Fehler beim senden an Influx->SendJsonToInfluxDB()");
|
||||
} else {
|
||||
IPS_LogMessage("Belevo_Server_Kommunikation", "Daten erfolgreich an Influx gesendet->SendJsonToInfluxDB()");
|
||||
}
|
||||
}
|
||||
*/
|
||||
private function SendJsonToInfluxDB($url, $jsonData) {
|
||||
// cURL Initialisieren
|
||||
$curl = curl_init();
|
||||
|
||||
Reference in New Issue
Block a user