V1.0 Stable

This commit is contained in:
2025-01-22 11:12:05 +01:00
parent 7856853146
commit 05be791fde
8 changed files with 137 additions and 74 deletions
+18 -3
View File
@@ -34,6 +34,8 @@ class WP_Steuerung extends IPSModule
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps");
$this->RegisterVariableInteger("Power", "Power");
$this->RegisterVariableBoolean("Is_Peak_Shaving", "Is_Peak_Shaving");
// Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2);
@@ -42,6 +44,9 @@ class WP_Steuerung extends IPSModule
// Initialisiere Idle
$this->SetValue("Idle", true);
$this->RegisterTimer("Timer_Do_UserCalc",5000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
}
public function ApplyChanges()
@@ -49,24 +54,34 @@ class WP_Steuerung extends IPSModule
parent::ApplyChanges();
}
// Aktionen verarbeiten
public function RequestAction($Ident, $Value)
{
switch ($Ident) {
case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value);
$this->SetValue("Power", (int)$Value);
break;
case "GetCurrentData":
return $this->GetCurrentData($Value);
$this->SetValue("Is_Peak_Shaving", (bool)$Value);
break;
case "ResetPowerSteps":
$this->ResetPowerSteps($Value);
break;
case "Do_UserCalc":
$this->SetAktuelle_Leistung($this->GetValue("Power"));
$this->GetCurrentData($this->GetValue("Is_Peak_Shaving"));
break;
default:
throw new Exception("Invalid Ident");
}
}
// Methode zum Setzen des aktuellen Stromverbrauchs
public function SetAktuelle_Leistung(float $power)
{