no message
This commit is contained in:
@@ -67,37 +67,6 @@ class Verbraucher_extern extends IPSModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
|
||||||
|
|
||||||
public function SetAktuelle_Leistung(float $power) {
|
|
||||||
$this->CheckIdle($power);
|
|
||||||
|
|
||||||
$verbraucherListe = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
|
|
||||||
$kombinationen = $this->kombinationenRekursiv($verbraucherListe, $power);
|
|
||||||
|
|
||||||
// Setze die Werte in Write_Var
|
|
||||||
foreach ($verbraucherListe as $verbraucher) {
|
|
||||||
$writeVarID = $verbraucher['Write_Var'];
|
|
||||||
$pNenn = $verbraucher['P_Nenn'];
|
|
||||||
$this->SetValue($writeVarID, in_array($pNenn, $kombinationen) ? 1 : 0);
|
|
||||||
}
|
|
||||||
$this->SetValue("Leistung_Delta", $power - array_sum($kombinationen));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Methode zum Abrufen der aktuellen Daten
|
|
||||||
public function GetCurrentData(bool $Peak)
|
|
||||||
{
|
|
||||||
// Setze die Is_Peak_Shaving Variable
|
|
||||||
$this->SetValue("Is_Peak_Shaving", $Peak);
|
|
||||||
|
|
||||||
$verbraucherListe = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
|
|
||||||
$kombinationen = $this->berechneKombinationen($verbraucherListe);
|
|
||||||
$this->SetValue("PowerSteps", implode(", ", $kombinationen));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function berechneKombinationen(array $verbraucherListe, float $power = null)
|
private function berechneKombinationen(array $verbraucherListe, float $power = null)
|
||||||
{
|
{
|
||||||
$kombinationen = [];
|
$kombinationen = [];
|
||||||
@@ -124,6 +93,33 @@ class Verbraucher_extern extends IPSModule
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||||
|
|
||||||
|
public function SetAktuelle_Leistung(float $power) {
|
||||||
|
$this->CheckIdle($power);
|
||||||
|
|
||||||
|
$verbraucherListe = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
|
||||||
|
$kombinationen = $this->kombinationenRekursiv($verbraucherListe, $power);
|
||||||
|
|
||||||
|
foreach ($verbraucherListe as $verbraucher) {
|
||||||
|
$writeVarID = $verbraucher['Write_Var'];
|
||||||
|
$pNenn = $verbraucher['P_Nenn'];
|
||||||
|
$this->SetValue($writeVarID, in_array($pNenn, $kombinationen) ? 1 : 0);
|
||||||
|
}
|
||||||
|
$this->SetValue("Leistung_Delta", $power - array_sum($kombinationen));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function GetCurrentData(bool $Peak)
|
||||||
|
{
|
||||||
|
$this->SetValue("Is_Peak_Shaving", $Peak);
|
||||||
|
$verbraucherListe = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
|
||||||
|
$kombinationen = $this->berechneKombinationen($verbraucherListe);
|
||||||
|
$this->SetValue("PowerSteps", implode(", ", $kombinationen));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function CheckIdle($power)
|
public function CheckIdle($power)
|
||||||
{
|
{
|
||||||
$lastpower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
$lastpower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||||
@@ -131,7 +127,6 @@ class Verbraucher_extern extends IPSModule
|
|||||||
$this->SetValue("Idle", false);
|
$this->SetValue("Idle", false);
|
||||||
$this->SetValue("IdleCounter",$this->ReadPropertyInteger("IdleCounterMax"));
|
$this->SetValue("IdleCounter",$this->ReadPropertyInteger("IdleCounterMax"));
|
||||||
}
|
}
|
||||||
// IdleCounter auslesen und verarbeiten
|
|
||||||
$idleCounter = $this->GetValue("IdleCounter");
|
$idleCounter = $this->GetValue("IdleCounter");
|
||||||
if ($idleCounter > 0) {
|
if ($idleCounter > 0) {
|
||||||
$this->SetValue("Idle", false);
|
$this->SetValue("Idle", false);
|
||||||
|
|||||||
Reference in New Issue
Block a user