From 03869aab995827dd0f294e425641d85ce2a81e22 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Tue, 21 Jan 2025 07:02:23 +0100 Subject: [PATCH] =?UTF-8?q?Boiler=20test=20hinzugef=C3=BCgz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Boiler_2_Stufig_Mit_Fueler/module.php | 38 +++++++++++++++++++++------ library.json | 2 +- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Boiler_2_Stufig_Mit_Fueler/module.php b/Boiler_2_Stufig_Mit_Fueler/module.php index 463d9fb..9b05be4 100644 --- a/Boiler_2_Stufig_Mit_Fueler/module.php +++ b/Boiler_2_Stufig_Mit_Fueler/module.php @@ -23,6 +23,7 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule $this->RegisterVariableInteger("Legionellentemperatur","Legionellentemperatur","",65); $this->RegisterVariableInteger("LegioCounter", "LegioCounter", "", 0); $this->RegisterVariableInteger("Boilertemperatur", "Boilertemperatur", "", 0); + $this->RegisterVariableInteger("Boilertemperatur_test", "Boilertemperatur_test", "", 0); // Variabeln für Kommunkation mit Manager @@ -112,22 +113,43 @@ class Boiler_2_Stufig_Mit_Fueler extends IPSModule $boilertemperatur_glätten = $this->ReadPropertyBoolean("Boilertemperatur_glätten"); if ($boilertemperatur_glätten) { + // Wenn Glättung aktiviert ist, führe das Glätten durch $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1"); + + + if (IPS_VariableExists($boilerFuehlerPT1ID)) { + $boilerPT1 = GetValue($boilerFuehlerPT1ID); + } else { + $boilerPT1 = 0.0; + } + + $boilerTemp_test = $this->GetIDForIdent("Boilertemperatur_test"); + if (IPS_VariableExists($boilerTemp_test)) { + $boilerTemp_test = $this->GetValue("Boilertemperatur_test"); + } else { + $boilerTemp_test = 0.0; + } - $boilerPT1 = $this->GetValue($boilerFuehlerPT1ID); - $boilerTemp = $this->GetValue("Boilertemperatur"); + $boilerPT1 = GetValue($boilerFuehlerPT1ID); + $boilerTemp_test = $this->GetValue("Boilertemperatur"); $time_constant= $this->ReadPropertyInteger("ZeitKonstante"); $delta_t = 30; $alpha = $delta_t / ($time_constant + $delta_t); - $newBoilerTemp = $boilerTemp + $alpha * ($boilerPT1 - $boilerTemp); - IPS_LogMessage("Boiler", "Mit Glättung, Boilertemperatur:$newBoilerTemp "); - $this->SetValue("Boilertemperatur", $newBoilerTemp); + $newBoilerTemp = $boilerTemp_test + $alpha * ($boilerPT1 - $boilerTemp_test); + IPS_LogMessage("Boiler", "Mit Glättung, Boilertemperatur_test:$newBoilerTemp "); + $this->SetValue("Boilertemperatur_test", $newBoilerTemp); } else { + // Wenn Glättung nicht aktiviert ist, setze die Boilertemperatur direkt auf den Wert des Boilerfühlers $boilerFuehlerPT1ID = $this->ReadPropertyInteger("Boilerfuehler_PT1"); - $boilerPT1 = $this->GetValue($boilerFuehlerPT1ID); - IPS_LogMessage("Boiler", "Keine Glättung, Boilertemperatur:$boilerPT1"); - $this->SetValue("Boilertemperatur", $boilerPT1); + if (IPS_VariableExists($boilerFuehlerPT1ID)) { + $boilerPT1 = GetValue($boilerFuehlerPT1ID); + } else { + $boilerPT1 = 0.0; + } + $boilerPT1 = GetValue($boilerFuehlerPT1ID); + IPS_LogMessage("Boiler", "Keine Gkättung, Boilertemperatur:$boilerPT1"); + $this->SetValue("Boilertemperatur_test", $boilerPT1); } diff --git a/library.json b/library.json index 4fc0843..81d58cc 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "0.273", + "version": "0.274", "build": 0, "date": 0