no message
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
class Puffer_Speicher extends IPSModule
|
||||
{
|
||||
private array $leistungArray = [0];
|
||||
|
||||
public function Create()
|
||||
{
|
||||
parent::Create();
|
||||
@@ -21,7 +23,7 @@ class Puffer_Speicher extends IPSModule
|
||||
$this->RegisterPropertyBoolean("Puffertemperatur_glätten", false);
|
||||
$this->RegisterPropertyString("Zeitplan", "");
|
||||
$this->RegisterPropertyInteger("Interval", 5); // Recheninterval
|
||||
$this->leistungArray = [0];
|
||||
|
||||
|
||||
// Puffer spezifische Variablen
|
||||
$this->RegisterVariableInteger("Steigung","Steigung","",0);
|
||||
@@ -67,7 +69,7 @@ class Puffer_Speicher extends IPSModule
|
||||
|
||||
}
|
||||
|
||||
private function LadeUndSortiereLeistungen()
|
||||
private function LadeUndSortiereLeistungen()
|
||||
{
|
||||
// Array initialisieren, immer mit 0
|
||||
$this->leistungArray = [0];
|
||||
@@ -120,30 +122,23 @@ class Puffer_Speicher extends IPSModule
|
||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||
public function SetAktuelle_Leistung(int $power)
|
||||
{
|
||||
$json = $this->ReadPropertyString("LeistungsStufen");
|
||||
$leistungsStufen = json_decode($json, true);
|
||||
|
||||
|
||||
|
||||
// Power = 0 → alle Kontakte aus
|
||||
// Power = 0 → alle Kontakte aus
|
||||
if ($power == 0) {
|
||||
foreach ($leistungsStufen as $stufe) {
|
||||
$kontaktID = $stufe['Schaltkontakt_Stufe'] ?? 0;
|
||||
if ($kontaktID > 0) {
|
||||
SetValue($kontaktID, false);
|
||||
}
|
||||
foreach ($this->leistungArray as $leistung) {
|
||||
$kontaktID = $this->GetKontaktIDZuLeistung($leistung);
|
||||
if ($kontaktID > 0) {
|
||||
SetValue($kontaktID, false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Power > 0 → passende Stufe aktivieren, andere bleiben unverändert
|
||||
foreach ($leistungsStufen as $stufe) {
|
||||
$leistung = $stufe['Leistung'] ?? 0;
|
||||
$kontaktID = $stufe['Schaltkontakt_Stufe'] ?? 0;
|
||||
|
||||
if ($leistung == $power && $kontaktID > 0) {
|
||||
SetValue($kontaktID, true);
|
||||
break; // nur eine Stufe aktiv
|
||||
}
|
||||
// Power > 0 → passende Stufe aktivieren
|
||||
foreach ($this->leistungArray as $leistung) {
|
||||
$kontaktID = $this->GetKontaktIDZuLeistung($leistung);
|
||||
if ($leistung == $power && $kontaktID > 0) {
|
||||
SetValue($kontaktID, true);
|
||||
break; // nur eine Stufe aktiv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,9 +157,34 @@ class Puffer_Speicher extends IPSModule
|
||||
// IdleCounter verarbeiten
|
||||
$this->ProcessIdleCounter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function GetKontaktIDZuLeistung(int $leistung): int
|
||||
{
|
||||
$json = $this->ReadPropertyString("LeistungsStufen");
|
||||
$leistungsStufen = json_decode($json, true);
|
||||
|
||||
if (is_array($leistungsStufen)) {
|
||||
foreach ($leistungsStufen as $stufe) {
|
||||
if (($stufe['Leistung'] ?? 0) == $leistung) {
|
||||
return $stufe['Schaltkontakt_Stufe'] ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Methode zum Abrufen der aktuellen Daten
|
||||
public function GetCurrentData(bool $Peak)
|
||||
{
|
||||
{
|
||||
if (empty($this->leistungArray)) {
|
||||
$this->LadeUndSortiereLeistungen();
|
||||
}
|
||||
|
||||
|
||||
$boilertemperatur_glätten = $this->ReadPropertyBoolean("Puffertemperatur_glätten");
|
||||
|
||||
Reference in New Issue
Block a user