weitere methode
This commit is contained in:
@@ -63,5 +63,148 @@ class WP_Steurung extends IPSModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Methode zum Setzen des aktuellen Stromverbrauchs
|
||||||
|
public function SetCurrentPower(float $power) {
|
||||||
|
|
||||||
|
$sperrzei_abs = 60*60*(GetValue($this->ReadPropertyInteger("Aussentemperatur"))+10)/25*60;
|
||||||
|
if($sperrzei_abs>6*60*60){
|
||||||
|
$sperrzei_abs = 6*60*60;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(GetValue($this->ReadPropertyInteger("Wolkenschwellwert"))<GetValue($this->ReadPropertyInteger("Wolkenwert")) || $sperrzei_abs < 0 ){
|
||||||
|
$sperrzei_abs = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
$sperrzeit = GetValue($this->ReadPropertyInteger("Referenzzeit"))%86400 - $sperrzei_abs;
|
||||||
|
$entsperrzeit = GetValue($this->ReadPropertyInteger("Referenzzeit"))%86400;
|
||||||
|
$aktuellezeit = time()%86400;
|
||||||
|
|
||||||
|
$its_lock_time = false;
|
||||||
|
if($aktuellezeit > $sperrzeit && $aktuellezeit < $entsperrzeit){
|
||||||
|
$its_lock_time = true;
|
||||||
|
}
|
||||||
|
$timestamp = time();
|
||||||
|
|
||||||
|
$this->CheckIdle($power);
|
||||||
|
|
||||||
|
if($this->GetValue("CurrentPower")!=$power){
|
||||||
|
$this->SetValue("WP_Laufzeit_Zahler", 0);
|
||||||
|
|
||||||
|
$LastPeak = $this->GetValue("LetzterPeakwert");
|
||||||
|
|
||||||
|
$state = $this->GetValue("Zustand_WP");
|
||||||
|
|
||||||
|
if($state == 0){
|
||||||
|
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
|
||||||
|
SetValue($this->ReadPropertyInteger("Kontakt_Erhoeung"), false);
|
||||||
|
|
||||||
|
}elseif($state == 1) // Normalbetrieb
|
||||||
|
{
|
||||||
|
if($LastPeak && $power == $this->GetValue("WP_Leistung")) {
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
if($its_lock_time){
|
||||||
|
$this->SetValue("Zustand_WP", 2);
|
||||||
|
}
|
||||||
|
} elseif($LastPeak && $power == 0){
|
||||||
|
$this->SetValue("Zustand_WP", 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif($LastPeak == false && $power == $this->GetValue("WP_Leistung")){
|
||||||
|
$this->SetValue("Zustand_WP", 3);
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif($LastPeak == false && $power == 0){
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
if($its_lock_time){
|
||||||
|
$this->SetValue("Zustand_WP", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}elseif($state == 2) // Sperre
|
||||||
|
{
|
||||||
|
if($LastPeak && $power == $this->GetValue("WP_Leistung")) {
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
if($its_lock_time){
|
||||||
|
$this->SetValue("Zustand_WP", 2);
|
||||||
|
}
|
||||||
|
} elseif($LastPeak && $power == 0){
|
||||||
|
$this->SetValue("Zustand_WP", 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif($LastPeak == false && $power == $this->GetValue("WP_Leistung")){
|
||||||
|
$this->SetValue("Zustand_WP", 3);
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif($LastPeak == false && $power == 0){
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
if($its_lock_time){
|
||||||
|
$this->SetValue("Zustand_WP", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}elseif($state == 3) // Erhöht
|
||||||
|
{
|
||||||
|
if($LastPeak && $power == $this->GetValue("WP_Leistung")) {
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
} elseif($LastPeak && $power == 0){
|
||||||
|
$this->SetValue("Zustand_WP", 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif($LastPeak == false && $power == $this->GetValue("WP_Leistung")){
|
||||||
|
$this->SetValue("Zustand_WP", 3);
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif($LastPeak == false && $power == 0){
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->SetValue("Zustand_WP", 1);
|
||||||
|
$this->SetValue("PowerSteps", json_encode([0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
$newState = $this->GetValue("Zustand_WP");
|
||||||
|
|
||||||
|
if($newState == 0){
|
||||||
|
|
||||||
|
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
|
||||||
|
SetValue($this->ReadPropertyInteger("Kontakt_Erhoeung"), false);
|
||||||
|
|
||||||
|
}elseif($newState == 1){
|
||||||
|
|
||||||
|
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
|
||||||
|
SetValue($this->ReadPropertyInteger("Kontakt_Erhoeung"), false);
|
||||||
|
|
||||||
|
}elseif($newState == 2){
|
||||||
|
|
||||||
|
SetValue($this->ReadPropertyInteger("Sperrkontakt"), true);
|
||||||
|
SetValue($this->ReadPropertyInteger("Kontakt_Erhoeung"), false);
|
||||||
|
|
||||||
|
}elseif($newState == 3){
|
||||||
|
|
||||||
|
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
|
||||||
|
SetValue($this->ReadPropertyInteger("Kontakt_Erhoeung"), true);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
|
||||||
|
SetValue($this->ReadPropertyInteger("Kontakt_Erhoeung"), false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
break;
|
||||||
|
$newCount = $this->GetValue("WP_Laufzeit_Zahler");
|
||||||
|
$this->SetValue("WP_Laufzeit_Zahler", ($newCount +1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "7.1"
|
"version": "7.1"
|
||||||
},
|
},
|
||||||
"version": "0.102",
|
"version": "0.103",
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"date": 0
|
"date": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user