From f90bda4133725fe310dac219d113bcd7655870d4 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Mon, 24 Feb 2025 08:40:42 +0100 Subject: [PATCH] gleiche wie vorhin --- Batterie/module.php | 19 ++++++++----------- library.json | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Batterie/module.php b/Batterie/module.php index 0b5a9cb..816027b 100644 --- a/Batterie/module.php +++ b/Batterie/module.php @@ -12,13 +12,12 @@ class Batterie extends IPSModule $this->RegisterPropertyInteger("AufdasNachladen",0); $this->RegisterPropertyInteger("MinimumEntladen",0); $this->RegisterPropertyInteger("Batterieladezustand",0); - + $this->RegisterPropertyFloat("Entladeleistung",0); + $this->RegisterPropertyFloat("Ladeleistung",0); // Variabeln für Kommunkation mit Manager $this->RegisterVariableFloat("Ladestrom", "Ladestrom", "", 0); $this->RegisterVariableFloat("Entladestrom", "Entladestrom", "", 0); - $this->RegisterVariableFloat("Ladeleistung", "Ladeleistung", "", 0); - $this->RegisterVariableFloat("Entladeleistung", "Entladeleistung", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableBoolean("Idle", "Idle", "", 0); @@ -94,15 +93,15 @@ public function RequestAction($Ident, $Value) { $ladeleistung = $this->ReadPropertyFloat("Ladeleistung"); - $entladeleistung = $this->ReadPropertyFloat("Entladeleistung"); // Korrigierter Name + $entladeleistung = $this->ReadPropertyFloat("Entladeleistung"); if ($power >= 0) { - $this->SetValue("Ladeleistung", $power); + SetValue($this->ReadPropertyFloat("Ladeleistung"), $power); } else { - $this->SetValue("Entladeleistung", abs($power)); + SetValue($this->ReadPropertyFloat("Entladeleistung"),abs($power)); } - $spannung = $this->ReadPropertyInteger("Batteriespannung"); // Spannung ebenfalls als Property + $spannung = $this->ReadPropertyInteger("Batteriespannung"); //$ladestrom = GetValue($this->GetIDForIdent("Ladestrom")); //$entladestrom = GetValue($this->GetIDForIdent("Entladestrom")); $ladestrom = $this->ReadPropertyFloat("Ladestrom"); @@ -113,17 +112,15 @@ public function RequestAction($Ident, $Value) IPS_LogMessage("Batterie", "Fehler: Batteriespannung ist 0 oder ungültig."); return; } - // Batterie entladen oder laden basierend auf der Leistung + if ($power >= 0) { $ladestrom = $power / $spannung; $this->SetValue("Ladestrom", $ladestrom); $this->SetValue("Entladestrom", 0); - //IPS_LogMessage("Batterie", "Ladestrom: " . $ladestrom); } else { $entladestrom = $power / $spannung; $this->SetValue("Entladestrom", $entladestrom); - $this->SetValue("Ladestrom", 0); - //IPS_LogMessage("Batterie", "Entladestrom: " . $entladestrom); + $this->SetValue("Ladestrom", 0); } // Prüfe auf Änderung der Leistung im Vergleich zur letzten Einstellung diff --git a/library.json b/library.json index c6a8e0e..8fcd1d8 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "1.047", + "version": "1.048", "build": 0, "date": 0 } \ No newline at end of file