änderungen an WP-Sperre

This commit is contained in:
2024-11-12 10:54:16 +01:00
parent fbb33ffa84
commit ff59cbaff6
2 changed files with 34 additions and 54 deletions

View File

@@ -12,6 +12,7 @@ class WP_Steuerung extends IPSModule {
// Energiehandling
$this->RegisterVariableBoolean("Idle", "Idle", "", true);
$this->RegisterVariableInteger("CurrentPower", "CurrentPower", "", 0);
$this->RegisterVariableBoolean("Sperrzeit", "Sperrzeit", "", false);
$this->RegisterVariableFloat("UsedEnergy", "UsedEnergy", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); // PowerSteps-Variable registrieren
@@ -80,20 +81,34 @@ class WP_Steuerung extends IPSModule {
$entsperrzeit = GetValue($this->ReadPropertyInteger("Referenzzeit"))%86400;
$aktuellezeit = time()%86400;
$its_lock_time = false;
if($aktuellezeit > $sperrzeit && $aktuellezeit < $entsperrzeit){
$its_lock_time = true;
}
$timestamp = time();
IPS_LogMessage("sperrzeit", $sperrzeit);
IPS_LogMessage("entsperrzeit", $entsperrzeit);
IPS_LogMessage("aktuellezeit", $aktuellezeit);
IPS_LogMessage("itslocktime", $its_lock_time);
IPS_LogMessage("sperrzeitabs", $sperrzei_abs);
$this->CheckIdle($power);
if($this->GetValue("CurrentPower")!=$power){
$its_lock_time = $this->GetValue("Sperrzeit");
if($aktuellezeit > $sperrzeit && $aktuellezeit < $entsperrzeit){
$this->SetValue("Sperrzeit", true);
}
else{
$this->SetValue("Sperrzeit", false);
}
$newlocktime = $this->GetValue("Sperrzeit");
if($newlocktime == true && $its_lock_time==false && $this->GetValue("WP_Laufzeit_Zahler")>240){
$this->SetValue("WP_Laufzeit_Zahler", 0);
SetValue($this->ReadPropertyInteger("Sperrkontakt"), true);
}
elseif($newlocktime == false && $its_lock_time == true && $this->GetValue("WP_Laufzeit_Zahler")>240){
$this->SetValue("WP_Laufzeit_Zahler", 0);
SetValue($this->ReadPropertyInteger("Sperrkontakt"), false);
}
elseif($this->GetValue("CurrentPower")!=$power){
$this->SetValue("WP_Laufzeit_Zahler", 0);
$LastPeak = $this->GetValue("LetzterPeakwert");
@@ -112,11 +127,7 @@ class WP_Steuerung extends IPSModule {
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", $this->ReadPropertyInteger("WP_Leistung"));
if($its_lock_time){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", $this->ReadPropertyInteger("WP_Leistung"));
}
} elseif($LastPeak && $power == 0){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
@@ -132,16 +143,6 @@ class WP_Steuerung extends IPSModule {
elseif($LastPeak == false && $power == 0){
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", 0);
IPS_LogMessage("here", $aktuellezeit);
if($its_lock_time){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
IPS_LogMessage("herrre", $aktuellezeit);
}
}
@@ -151,11 +152,7 @@ class WP_Steuerung extends IPSModule {
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", $this->ReadPropertyInteger("WP_Leistung"));
if($its_lock_time){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", $this->ReadPropertyInteger("WP_Leistung"));
}
} elseif($LastPeak && $power == 0){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
@@ -171,16 +168,8 @@ class WP_Steuerung extends IPSModule {
elseif($LastPeak == false && $power == 0){
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", 0);
IPS_LogMessage("herrre", $aktuellezeit);
if($its_lock_time){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
IPS_LogMessage("here", $aktuellezeit);
}
}
}elseif($state == 3) // Erhöht
@@ -190,11 +179,6 @@ class WP_Steuerung extends IPSModule {
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", $this->ReadPropertyInteger("WP_Leistung"));
if($its_lock_time){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", $this->ReadPropertyInteger("WP_Leistung"));
}
} elseif($LastPeak && $power == 0){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
@@ -211,12 +195,6 @@ class WP_Steuerung extends IPSModule {
$this->SetValue("Zustand_WP", 1);
$this->SetValue("CurrentPower", 0);
if($its_lock_time){
$this->SetValue("Zustand_WP", 2);
$this->SetValue("CurrentPower", 0);
}
}
}
@@ -277,7 +255,9 @@ class WP_Steuerung extends IPSModule {
$this->SetValue("PowerSteps", json_encode([$this->GetValue("CurrentPower")]));
}else{
}
else{
$this->SetValue("PowerSteps", json_encode([0, $this->ReadPropertyInteger("WP_Leistung")]));

View File

@@ -6,7 +6,7 @@
"compatibility": {
"version": "7.1"
},
"version": "0.127",
"version": "0.128",
"build": 0,
"date": 0
}