diff --git a/Batterie/module.php b/Batterie/module.php index 0e16886..b321a7a 100644 --- a/Batterie/module.php +++ b/Batterie/module.php @@ -12,8 +12,8 @@ class Batterie extends IPSModule $this->RegisterPropertyInteger("AufdasNachladen",0); $this->RegisterPropertyInteger("MinimumEntladen",0); $this->RegisterPropertyInteger("Batterieladezustand",0); - $this->RegisterPropertyFloat("Entladeleistung",0); - $this->RegisterPropertyFloat("Ladeleistung",0); + $this->ReadPropertyInteger("Entladeleistung",0); + $this->ReadPropertyInteger("Ladeleistung",0); // Variabeln für Kommunkation mit Manager $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); @@ -91,14 +91,27 @@ public function RequestAction($Ident, $Value) public function SetAktuelle_Leistung(int $power) { - + /* if ($power >= 0){ SetValue($this->ReadPropertyFloat("Ladeleistung"), $power); SetValue($this->ReadPropertyFloat("Entladeleistung"),0); }else{ SetValue($this->ReadPropertyFloat("Entladeleistung"), abs($power)); SetValue($this->ReadPropertyFloat("Ladeleistung"), 0); + }*/ + + $ladeleistungID = $this->ReadPropertyInteger("Ladeleistung"); + $entladeleistungID = $this->ReadPropertyInteger("Entladeleistung"); + + if ($ladeleistungID > 0 && IPS_VariableExists($ladeleistungID)) { + SetValue($ladeleistungID, floatval($power)); } + + if ($entladeleistungID > 0 && IPS_VariableExists($entladeleistungID)) { + SetValue($entladeleistungID, floatval(abs($power))); + } + + /* $entladeleistungID = $this->ReadPropertyFloat("Entladeleistung"); diff --git a/library.json b/library.json index b4978d3..795a549 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "1.062", + "version": "1.063", "build": 0, "date": 0 } \ No newline at end of file