Auf stand Von testign gebracht
This commit is contained in:
@@ -7,42 +7,35 @@ class Verbraucher_1_Stufig extends IPSModule
|
||||
{
|
||||
parent::Create();
|
||||
|
||||
// Prioritäten
|
||||
$this->RegisterVariableInteger("LockPrio", "LockPrio");
|
||||
$this->RegisterVariableInteger("UserPrio", "UserPrio");
|
||||
|
||||
// Energiehandling
|
||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||
$this->RegisterVariableBoolean("IstNacht", "IstNacht", "", 0);
|
||||
$this->RegisterVariableInteger("CurrentPower", "CurrentPower", "", 0);
|
||||
$this->RegisterVariableInteger("DailyOnTime", "DailyOnTime", "", 0);
|
||||
$this->RegisterVariableFloat("UsedEnergy", "UsedEnergy", "", 0);
|
||||
$this->RegisterVariableString("PowerSteps", "PowerSteps"); // PowerSteps-Variable registrieren
|
||||
|
||||
// Neue Variable für den Timer-Status
|
||||
$this->RegisterVariableBoolean("IsTimerActive", "IsTimerActive", "", 0);
|
||||
$this->SetValue("IsTimerActive", false);
|
||||
|
||||
// Trägheit
|
||||
$this->RegisterPropertyInteger("IdleCounterMax", 4);
|
||||
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
||||
$this->SetValue("IdleCounter", 0);
|
||||
|
||||
// Verbraucherspezifische Properties
|
||||
$this->RegisterPropertyInteger("BoilerLeistung", 6000); // Standardwert für Volllast
|
||||
$this->RegisterPropertyInteger("Mindesttlaufzeit", 4); // Standardwert für Volllast
|
||||
$this->RegisterPropertyInteger("Zeit_Zwischen_Zustandswechseln", 1);
|
||||
$this->RegisterPropertyInteger("Schaltkontakt1", 0);
|
||||
|
||||
// Timer für Zeit_Zwischen_Zustandswechseln
|
||||
$this->RegisterTimer(
|
||||
"ZustandswechselTimer",
|
||||
0,
|
||||
"IPS_RequestAction(" .
|
||||
$this->InstanceID .
|
||||
', "ResetPowerSteps", "");'
|
||||
);
|
||||
// Verbraucherspezifische Variabeln
|
||||
$this->RegisterVariableBoolean("IstNacht", "IstNacht", "", 0);
|
||||
$this->RegisterVariableInteger("DailyOnTime", "DailyOnTime", "", 0);
|
||||
$this->RegisterVariableBoolean("IsTimerActive", "IsTimerActive", "", 0);
|
||||
|
||||
//Initialisieren
|
||||
// Verbraucherspezifischer Timer
|
||||
$this->SetValue("IsTimerActive", false);
|
||||
$this->RegisterTimer("ZustandswechselTimer",0,"IPS_RequestAction(" .$this->InstanceID .', "ResetPowerSteps", "");');
|
||||
|
||||
// Variabeln für Kommunkation mit Manager
|
||||
$this->RegisterVariableInteger("Sperre_Prio", "Sperre_Prio");
|
||||
$this->RegisterVariableInteger("PV_Prio", "PV_Prio");
|
||||
$this->RegisterVariableBoolean("Idle", "Idle", "", 0);
|
||||
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
|
||||
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
|
||||
$this->RegisterVariableString("PowerSteps", "PowerSteps");
|
||||
|
||||
// Hilfsvariabeln für Idle zustand
|
||||
$this->RegisterPropertyInteger("IdleCounterMax", 2);
|
||||
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
||||
$this->SetValue("IdleCounter", 0);
|
||||
|
||||
// Initialisiere Idle
|
||||
$this->SetValue("Idle", true);
|
||||
}
|
||||
|
||||
@@ -55,8 +48,8 @@ class Verbraucher_1_Stufig extends IPSModule
|
||||
public function RequestAction($Ident, $Value)
|
||||
{
|
||||
switch ($Ident) {
|
||||
case "SetCurrentPower":
|
||||
$this->SetCurrentPower($Value);
|
||||
case "SetAktuelle_Leistung":
|
||||
$this->SetAktuelle_Leistung($Value);
|
||||
break;
|
||||
case "GetCurrentData":
|
||||
return $this->GetCurrentData($Value);
|
||||
@@ -92,7 +85,7 @@ class Verbraucher_1_Stufig extends IPSModule
|
||||
// PowerSteps wieder auf den ursprünglichen Zustand setzen (wie vorherige Funktionalität)
|
||||
$this->SetValue(
|
||||
"PowerSteps",
|
||||
json_encode([$this->GetValue("CurrentPower")])
|
||||
json_encode([$this->GetValue("Aktuelle_Leistung")])
|
||||
);
|
||||
|
||||
// Timer stoppen
|
||||
@@ -102,13 +95,13 @@ class Verbraucher_1_Stufig extends IPSModule
|
||||
$this->SetValue("IsTimerActive", false);
|
||||
}
|
||||
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||
public function SetCurrentPower(float $power)
|
||||
public function SetAktuelle_Leistung(float $power)
|
||||
{
|
||||
$this->CheckIdle($power);
|
||||
if ($this->GetValue("CurrentPower") != $power) {
|
||||
if ($this->GetValue("Aktuelle_Leistung") != $power) {
|
||||
$this->SetTimerOn();
|
||||
}
|
||||
$this->SetValue("CurrentPower", $power);
|
||||
$this->SetValue("Aktuelle_Leistung", $power);
|
||||
$boilerLeistung = $this->ReadPropertyInteger("BoilerLeistung");
|
||||
$schaltkontaktID = $this->ReadPropertyInteger("Schaltkontakt1");
|
||||
|
||||
@@ -155,7 +148,7 @@ class Verbraucher_1_Stufig extends IPSModule
|
||||
// Timer ist aktiv, PowerSteps setzen
|
||||
$this->SetValue(
|
||||
"PowerSteps",
|
||||
json_encode([$this->GetValue("CurrentPower")])
|
||||
json_encode([$this->GetValue("Aktuelle_Leistung")])
|
||||
);
|
||||
}
|
||||
// Wenn Nacht und Mindestlaufzeit nicht erreicht ist
|
||||
@@ -185,7 +178,7 @@ class Verbraucher_1_Stufig extends IPSModule
|
||||
|
||||
public function CheckIdle($power)
|
||||
{
|
||||
$lastpower = GetValue($this->GetIDForIdent("CurrentPower"));
|
||||
$lastpower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||
if ($lastpower != $power) {
|
||||
$this->SetValue("Idle", false);
|
||||
$this->SetValue("IdleCounter",$this->ReadPropertyInteger("IdleCounterMax"));
|
||||
|
||||
Reference in New Issue
Block a user