diff --git a/Batterie/module.php b/Batterie/module.php index 9300d35..e91cfe5 100644 --- a/Batterie/module.php +++ b/Batterie/module.php @@ -16,9 +16,6 @@ class Batterie extends IPSModule $this->RegisterPropertyFloat("Ladeleistung",0); // Variabeln für Kommunkation mit Manager - - $this->RegisterVariableFloat("Ladestrom", "Ladestrom", "", 0); - $this->RegisterVariableFloat("Entladestrom", "Entladestrom", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableBoolean("Idle", "Idle", "", 0); @@ -29,8 +26,8 @@ class Batterie extends IPSModule $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); - $this->RegisterVariableInteger("AktuelleLadeleistung", "Aktuelle Ladeleistung", "", 0); - $this->RegisterVariableInteger("AktuelleEntladeleistung", "Aktuelle Entladeleistung", "", 0); + //$this->RegisterVariableInteger("AktuelleLadeleistung", "Aktuelle Ladeleistung", "", 0); + //$this->RegisterVariableInteger("AktuelleEntladeleistung", "Aktuelle Entladeleistung", "", 0); // Hilfsvariabeln für Idle zustand $this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0); @@ -94,32 +91,39 @@ public function RequestAction($Ident, $Value) public function SetAktuelle_Leistung(int $power) { + $entladeleistung = $this->ReadPropertyFloat("Entladeleistung"); + $ladeleistung = $this->ReadPropertyFloat("Ladeleistung"); - // Ausgewählte Variablen aus der Instanzkonfiguration lesen + if ($power >= 0){ + SetValue($this->ReadPropertyInteger("Ladeleistung"), $power); + }else{ + SetValue($this->ReadPropertyInteger("Entladeleistung"), abs($power)); + } + + /* $entladeleistungID = $this->ReadPropertyFloat("Entladeleistung"); $ladeleistungID = $this->ReadPropertyFloat("Ladeleistung"); - // Überprüfen, ob die Entladeleistung-ID korrekt gesetzt ist + if ($entladeleistungID > 0) { if ($power < 0) { - // Entladeleistung setzen (wenn power negativ ist) + $this->SetValue("AktuelleEntladeleistung", abs($power)); - $this->SetValue("AktuelleLadeleistung", 0); // Ladeleistung auf 0 setzen + $this->SetValue("AktuelleLadeleistung", 0); } else { - // Ladeleistung auf 0 setzen, wenn keine Entladung stattfindet + $this->SetValue("AktuelleEntladeleistung", 0); } } - // Überprüfen, ob die Ladeleistung-ID korrekt gesetzt ist if ($ladeleistungID > 0) { if ($power >= 0) { - // Ladeleistung setzen (wenn power positiv ist) + $this->SetValue("AktuelleLadeleistung", $power); - $this->SetValue("AktuelleEntladeleistung", 0); // Entladeleistung auf 0 setzen + $this->SetValue("AktuelleEntladeleistung", 0); } else { - // Ladeleistung auf 0 setzen, wenn keine Aufladung stattfindet + $this->SetValue("AktuelleLadeleistung", 0); } - } + }*/ // Prüfe auf Änderung der Leistung im Vergleich zur letzten Einstellung diff --git a/library.json b/library.json index bea0250..366ac30 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "1.058", + "version": "1.059", "build": 0, "date": 0 } \ No newline at end of file