From 9b0d1a328afdb0cdabaeb677f728da13c30a4105 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Mon, 24 Feb 2025 07:55:42 +0100 Subject: [PATCH] =?UTF-8?q?Leistung=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Batterie/form.json | 8 ++++---- Batterie/module.php | 17 +++++++++++++---- library.json | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Batterie/form.json b/Batterie/form.json index ccfd839..a2023b4 100644 --- a/Batterie/form.json +++ b/Batterie/form.json @@ -37,14 +37,14 @@ }, { "type": "SelectVariable", - "name": "Ladestrom", - "caption": "Ladestrom", + "name": "Entladeleistung", + "caption": "Entladeleistung", "test": true }, { "type": "SelectVariable", - "name": "Entladestrom", - "caption": "Entladestrom", + "name": "Ladeleistung", + "caption": "Ladeleistung", "test": true } diff --git a/Batterie/module.php b/Batterie/module.php index ef500b9..0b5a9cb 100644 --- a/Batterie/module.php +++ b/Batterie/module.php @@ -12,12 +12,13 @@ class Batterie extends IPSModule $this->RegisterPropertyInteger("AufdasNachladen",0); $this->RegisterPropertyInteger("MinimumEntladen",0); $this->RegisterPropertyInteger("Batterieladezustand",0); - //$this->RegisterPropertyFloat("Ladestrom",0); - //$this->RegisterPropertyFloat("Entladestrom",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); @@ -91,8 +92,16 @@ public function RequestAction($Ident, $Value) public function SetAktuelle_Leistung(int $power) { - $batterieladezustand = $this->ReadPropertyInteger("Batterieladezustand"); // Als Property gelesen - $maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung"); // Als Property gelesen + + $ladeleistung = $this->ReadPropertyFloat("Ladeleistung"); + $entladeleistung = $this->ReadPropertyFloat("Entladeleistung"); // Korrigierter Name + + if ($power >= 0) { + $this->SetValue("Ladeleistung", $power); + } else { + $this->SetValue("Entladeleistung", abs($power)); + } + $spannung = $this->ReadPropertyInteger("Batteriespannung"); // Spannung ebenfalls als Property //$ladestrom = GetValue($this->GetIDForIdent("Ladestrom")); //$entladestrom = GetValue($this->GetIDForIdent("Entladestrom")); diff --git a/library.json b/library.json index 45652a4..c6a8e0e 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "1.046", + "version": "1.047", "build": 0, "date": 0 } \ No newline at end of file