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

View File

@@ -29,6 +29,8 @@ class Verbraucher_1_Stufig 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);
@@ -37,6 +39,9 @@ class Verbraucher_1_Stufig extends IPSModule
// Initialisiere Idle
$this->SetValue("Idle", true);
$this->RegisterTimer("Timer_Do_UserCalc",5000,"IPS_RequestAction(" .$this->InstanceID .', "Do_UserCalc", "");');
}
public function ApplyChanges()
@@ -44,24 +49,34 @@ class Verbraucher_1_Stufig 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 der PowerSteps und Timer starten
public function SetTimerOn()
{