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