diff --git a/Batterie/form.json b/Batterie/form.json index a2023b4..c189186 100644 --- a/Batterie/form.json +++ b/Batterie/form.json @@ -29,6 +29,21 @@ "caption": "Minimum des Batterieladezustand", "suffix": "" }, + { + "type":"Select", + "name":"Batteriemanagement", + "caption":"Batteriemanagement", + "options":[ + { + "caption":"Vom Wechelrichterhertseller", + "value":1 + }, + { + "caption":"Von der Firma Belevo", + "value":4 + } + ] + }, { "type": "SelectVariable", "name": "Batterieladezustand", diff --git a/Batterie/module.php b/Batterie/module.php index 153f418..1c0753a 100644 --- a/Batterie/module.php +++ b/Batterie/module.php @@ -12,10 +12,13 @@ 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->RegisterPropertyInteger("Batteriemanagement", 1); + //$this->RegisterPropertyFloat("Entladeleistung",0); + //$this->RegisterPropertyFloat("Ladeleistung",0); // Variabeln für Kommunkation mit Manager + $this->RegisterVariableFloat("Entladeleistung","Entladeleistung",0); + $this->RegisterVariableFloat("Ladeleistung","Ladeleistung",0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableBoolean("Idle", "Idle", "", 0); @@ -26,8 +29,6 @@ class Batterie extends IPSModule $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 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); @@ -91,19 +92,32 @@ public function RequestAction($Ident, $Value) public function SetAktuelle_Leistung(int $power) { - + $batterieManagement = $this->ReadPropertyInteger("Batteriemanagement"); + // Wechselrichter steuert das Laden/Entladen der Batterie + if ($batterieManagement == 1) { + return; + } + + /* 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); + }*/ + + + if ($power >= 0) { + SetValue($this->GetIDForIdent("Ladeleistung"), $power); + SetValue($this->GetIDForIdent("Entladeleistung"), 0); + } else { + SetValue($this->GetIDForIdent("Entladeleistung"), abs($power)); + SetValue($this->GetIDForIdent("Ladeleistung"), 0); } - - /* $entladeleistungID = $this->ReadPropertyFloat("Entladeleistung"); $ladeleistungID = $this->ReadPropertyFloat("Ladeleistung"); diff --git a/library.json b/library.json index a384a2c..17e797a 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "1.067", + "version": "1.068", "build": 0, "date": 0 } \ No newline at end of file