no message
This commit is contained in:
@@ -52,7 +52,19 @@
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "Zeit_Zwischen_Zustandswechseln",
|
||||
"caption": "Mindestlaufzeit des Verbrauchers bei Lastschaltung (Für Easee Solarladen zwingend 1 Minute einstellen)",
|
||||
"caption": "Mindestlaufzeit des Verbrauchers bei Lastschaltung ",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "Ein_Zeit",
|
||||
"caption": "Mindestlaufzeit Ladestation wenn Ein",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
"type": "NumberSpinner",
|
||||
"name": "Aus_Zeit",
|
||||
"caption": "Mindestlaufzeit Ladestation wenn Aus",
|
||||
"suffix": ""
|
||||
},
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@ class Ladestation_v2 extends IPSModule
|
||||
$this->RegisterPropertyInteger("Interval", 5); // Recheninterval
|
||||
$this->RegisterPropertyInteger("Max_Current_abs", 32); // Recheninterval
|
||||
$this->RegisterPropertyInteger("Zeit_Zwischen_Zustandswechseln", 1);
|
||||
$this->RegisterPropertyInteger("Ein_Zeit", 0); // Recheninterval
|
||||
$this->RegisterPropertyInteger("Aus_Zeit", 0); // Recheninterval
|
||||
$this->RegisterPropertyInteger("Token_Easee", 0); // Recheninterval
|
||||
$this->RegisterPropertyInteger("Token_ECarUp", 0); // Recheninterval
|
||||
|
||||
@@ -41,8 +43,15 @@ class Ladestation_v2 extends IPSModule
|
||||
IPS_SetHidden($this->GetIDForIdent("Peak"), true);
|
||||
|
||||
$this->RegisterVariableBoolean("IsTimerActive", "IsTimerActive", "", false);
|
||||
IPS_SetHidden($this->GetIDForIdent("IsTimerActive"), true);
|
||||
|
||||
$this->RegisterTimer("ZustandswechselTimer",0,"IPS_RequestAction(" .$this->InstanceID .', "ResetTimer", "");');
|
||||
|
||||
$this->RegisterVariableBoolean("IsTimerActive_Null_Timer", "IsTimerActive_Null_Timer", "", false);
|
||||
IPS_SetHidden($this->GetIDForIdent("IsTimerActive_Null_Timer"), true);
|
||||
|
||||
$this->RegisterTimer("Null_Timer",0,"IPS_RequestAction(" .$this->InstanceID .', "ResetNullTimer", "");');
|
||||
|
||||
$this->RegisterVariableString("Letzer_User", "Letzter registrierter Benutzer");
|
||||
|
||||
|
||||
@@ -156,6 +165,10 @@ class Ladestation_v2 extends IPSModule
|
||||
|
||||
case "ResetTimer":
|
||||
$this->ResetTimer();
|
||||
break;
|
||||
|
||||
case "ResetNullTimer":
|
||||
$this->ResetNullTimer();
|
||||
break;
|
||||
|
||||
case "Refresh_Token":
|
||||
@@ -249,6 +262,21 @@ class Ladestation_v2 extends IPSModule
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Methode zum Setzen der PowerSteps und Timer starten
|
||||
public function SetTimerNullMindestlast($time)
|
||||
{
|
||||
if($time>0){
|
||||
$this->SetTimerInterval("Null_Timer", $time * 60000); // Timer in Millisekunden
|
||||
// Timer-Status auf true setzen
|
||||
$this->SetValue("IsTimerActive_Null_Timer", true);
|
||||
}else{
|
||||
$this->SetValue("IsTimerActive_Null_Timer", false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Methode zum Zurücksetzen von PowerSteps nach Ablauf des Timers
|
||||
public function ResetTimer()
|
||||
{
|
||||
@@ -259,6 +287,17 @@ class Ladestation_v2 extends IPSModule
|
||||
$this->SetValue("IsTimerActive", false);
|
||||
}
|
||||
|
||||
// Methode zum Zurücksetzen von PowerSteps nach Ablauf des Timers
|
||||
public function ResetNullTimer()
|
||||
{
|
||||
// Timer stoppen
|
||||
$this->SetTimerInterval("Null_Timer", 0);
|
||||
|
||||
// Timer-Status auf false setzen
|
||||
$this->SetValue("IsTimerActive_Null_Timer", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function Get_Car_Status(int $carType)
|
||||
{
|
||||
@@ -494,10 +533,24 @@ class Ladestation_v2 extends IPSModule
|
||||
return $current;
|
||||
}
|
||||
|
||||
public function Get_Array_From_Current(bool $is_1_ph, float $current)
|
||||
public function Get_Array_From_Current(bool $is_1_ph, float $current, int $power, bool $timer)
|
||||
{
|
||||
$resultArray = [];
|
||||
$resultArray[] = 0;
|
||||
|
||||
if ($timer) {
|
||||
// Timer an
|
||||
if ($power === 0) {
|
||||
// power == 0: nur eine 0 zurückgeben
|
||||
$resultArray[] = 0;
|
||||
return $resultArray;
|
||||
}
|
||||
// power > 0: keine 0 am Anfang, Schleife normal durchlaufen
|
||||
} else {
|
||||
// Timer aus: wie bisher, 0 am Anfang
|
||||
$resultArray[] = 0;
|
||||
}
|
||||
|
||||
// Schleife wie gehabt
|
||||
for ($i = 6; $i <= $current; $i++) {
|
||||
if ($is_1_ph) {
|
||||
$resultArray[] = $i * 230;
|
||||
@@ -505,12 +558,13 @@ class Ladestation_v2 extends IPSModule
|
||||
$resultArray[] = $i * 400 * 1.71;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $resultArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function SetAktuelle_Leistung(int $power)
|
||||
{
|
||||
// Hier eine Leistungsänderung detektieren für Idle und interne Mindestlaufzeiten
|
||||
@@ -519,6 +573,14 @@ class Ladestation_v2 extends IPSModule
|
||||
$this->SetTimerOn();
|
||||
}
|
||||
|
||||
if (($this->GetValue("Aktuelle_Leistung") == 0) && ($power>0)) {
|
||||
$this->SetTimerNullMindestlast($this->ReadPropertyInteger("Ein_Zeit"));
|
||||
}
|
||||
elseif(($this->GetValue("Aktuelle_Leistung") > 0) && ($power==0)){
|
||||
$this->SetTimerNullMindestlast($this->ReadPropertyInteger("Aus_Zeit"));
|
||||
|
||||
}
|
||||
|
||||
$internalPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||
|
||||
// Aktuelle Leistungsvorgabe setzen
|
||||
@@ -532,7 +594,7 @@ class Ladestation_v2 extends IPSModule
|
||||
if ($power != $internalPower) {
|
||||
// Setze die interne Leistungsvorgabe
|
||||
|
||||
// Idle für 4 Zyklen auf false setzen
|
||||
// Idle für x Zyklen auf false setzen
|
||||
SetValue($this->GetIDForIdent("Idle"), false);
|
||||
SetValue(
|
||||
$this->GetIDForIdent("IdleCounter"),
|
||||
@@ -599,13 +661,13 @@ class Ladestation_v2 extends IPSModule
|
||||
if (!$ladebereit) {
|
||||
$powerSteps = [0];
|
||||
} elseif (!$Peak && !$solarladen) {
|
||||
$powerSteps = [max($this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current")))];
|
||||
$powerSteps = [max($this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current"), $this->GetValue("Aktuelle_Leistung"), $this->GetValue("IsTimerActive_Null_Timer")))];
|
||||
} elseif (!$Peak && $solarladen) {
|
||||
$powerSteps = $this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current"));
|
||||
$powerSteps = $this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current"), $this->GetValue("Aktuelle_Leistung"), $this->GetValue("IsTimerActive_Null_Timer"));
|
||||
} elseif ($solarladen && $Peak) {
|
||||
$powerSteps = [0];
|
||||
} else {
|
||||
$powerSteps = $this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current"));
|
||||
$powerSteps = $this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current"), $this->GetValue("Aktuelle_Leistung"), $this->GetValue("IsTimerActive_Null_Timer"));
|
||||
}
|
||||
|
||||
// PowerSteps in der RegisterVariable speichern
|
||||
@@ -616,7 +678,7 @@ class Ladestation_v2 extends IPSModule
|
||||
if($this->GetValue("Aktuelle_Leistung")>(1.11*$this->GetValue("Ladeleistung_Effektiv"))){
|
||||
$this->SetValue("Pending_Counter", $counter+1);
|
||||
|
||||
}elseif(max($this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current")))<(1.11*$this->GetValue("Ladeleistung_Effektiv"))){ // diesen elseif ggf wieder rauslöschen
|
||||
}elseif(max($this->Get_Array_From_Current($this->GetValue("Is_1_ph"),$this->GetValue("Max_Current"), $this->GetValue("Aktuelle_Leistung"), $this->GetValue("IsTimerActive_Null_Timer")))<(1.11*$this->GetValue("Ladeleistung_Effektiv"))){ // diesen elseif ggf wieder rauslöschen
|
||||
$this->SetValue("Pending_Counter", $counter+1);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user