67 lines
2.2 KiB
PHP
67 lines
2.2 KiB
PHP
<?php
|
|
class WP_Steurung extends IPSModule {
|
|
|
|
|
|
public function Create() {
|
|
parent::Create();
|
|
|
|
// Prioritäten
|
|
$this->RegisterVariableInteger("LockPrio", "LockPrio");
|
|
$this->RegisterVariableInteger("UserPrio", "UserPrio");
|
|
|
|
// Energiehandling
|
|
$this->RegisterVariableBoolean("Idle", "Idle", "", true);
|
|
$this->RegisterVariableInteger("CurrentPower", "CurrentPower", "", 0);
|
|
$this->RegisterVariableFloat("UsedEnergy", "UsedEnergy", "", 0);
|
|
$this->RegisterVariableString("PowerSteps", "PowerSteps"); // PowerSteps-Variable registrieren
|
|
|
|
// Trägheit
|
|
$this->RegisterPropertyInteger("IdleCounterMax", 4);
|
|
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
|
|
$this->SetValue("IdleCounter", 0);
|
|
|
|
$this->RegisterVariableInteger("Mindestlaufzeit", "IdleCounter", "", 0);
|
|
|
|
$this->RegisterVariableInteger("Zustand_WP", "Zustand_WP", "", 0);
|
|
|
|
$this->RegisterVariableInteger("WP_Laufzeit_Zahler", "WP_Laufzeit_Zahler", "", 20*12);
|
|
$this->RegisterVariableBoolean("LetzterPeakwert", "LetzterPeakwert", "", false);
|
|
|
|
|
|
|
|
|
|
$this->RegisterPropertyInteger("WP_Leistung", 6000);
|
|
$this->RegisterPropertyInteger("Wolkenschwellwert", 60);
|
|
$this->RegisterPropertyInteger("Wolkenwert", 0);
|
|
$this->RegisterPropertyInteger("Aussentemperatur", 0);
|
|
$this->RegisterPropertyInteger("Referenzzeit", 0);
|
|
$this->RegisterPropertyInteger("Sperrkontakt", 0);
|
|
$this->RegisterPropertyInteger("Kontakt_Erhoeung", 0);
|
|
|
|
//Initialisieren
|
|
$this->SetValue("Idle", true);
|
|
}
|
|
|
|
public function ApplyChanges() {
|
|
parent::ApplyChanges();
|
|
}
|
|
|
|
// Aktionen verarbeiten
|
|
public function RequestAction($Ident, $Value) {
|
|
switch ($Ident) {
|
|
case "SetCurrentPower":
|
|
$this->SetCurrentPower($Value);
|
|
break;
|
|
case "GetCurrentData":
|
|
return $this->GetCurrentData($Value);
|
|
break;
|
|
case "ResetPowerSteps":
|
|
$this->ResetPowerSteps($Value);
|
|
break;
|
|
default:
|
|
throw new Exception("Invalid Ident");
|
|
}
|
|
}
|
|
|
|
}
|
|
?>
|