leistung wieder hinzugefügt

This commit is contained in:
belevo\mh
2025-02-24 11:54:56 +01:00
parent d7a8d1eb99
commit 10c9acb352
2 changed files with 20 additions and 16 deletions

View File

@@ -16,9 +16,6 @@ class Batterie extends IPSModule
$this->RegisterPropertyFloat("Ladeleistung",0); $this->RegisterPropertyFloat("Ladeleistung",0);
// Variabeln für Kommunkation mit Manager // Variabeln für Kommunkation mit Manager
$this->RegisterVariableFloat("Ladestrom", "Ladestrom", "", 0);
$this->RegisterVariableFloat("Entladestrom", "Entladestrom", "", 0);
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0); $this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
$this->RegisterVariableString("PowerSteps", "PowerSteps"); $this->RegisterVariableString("PowerSteps", "PowerSteps");
$this->RegisterVariableBoolean("Idle", "Idle", "", 0); $this->RegisterVariableBoolean("Idle", "Idle", "", 0);
@@ -29,8 +26,8 @@ class Batterie extends IPSModule
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0); $this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
$this->RegisterVariableInteger("AktuelleLadeleistung", "Aktuelle Ladeleistung", "", 0); //$this->RegisterVariableInteger("AktuelleLadeleistung", "Aktuelle Ladeleistung", "", 0);
$this->RegisterVariableInteger("AktuelleEntladeleistung", "Aktuelle Entladeleistung", "", 0); //$this->RegisterVariableInteger("AktuelleEntladeleistung", "Aktuelle Entladeleistung", "", 0);
// Hilfsvariabeln für Idle zustand // Hilfsvariabeln für Idle zustand
$this->RegisterPropertyInteger("IdleCounterMax", 2); $this->RegisterPropertyInteger("IdleCounterMax", 2);
$this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0); $this->RegisterVariableInteger("IdleCounter", "IdleCounter", "", 0);
@@ -94,32 +91,39 @@ public function RequestAction($Ident, $Value)
public function SetAktuelle_Leistung(int $power) 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"); $entladeleistungID = $this->ReadPropertyFloat("Entladeleistung");
$ladeleistungID = $this->ReadPropertyFloat("Ladeleistung"); $ladeleistungID = $this->ReadPropertyFloat("Ladeleistung");
// Überprüfen, ob die Entladeleistung-ID korrekt gesetzt ist
if ($entladeleistungID > 0) { if ($entladeleistungID > 0) {
if ($power < 0) { if ($power < 0) {
// Entladeleistung setzen (wenn power negativ ist)
$this->SetValue("AktuelleEntladeleistung", abs($power)); $this->SetValue("AktuelleEntladeleistung", abs($power));
$this->SetValue("AktuelleLadeleistung", 0); // Ladeleistung auf 0 setzen $this->SetValue("AktuelleLadeleistung", 0);
} else { } else {
// Ladeleistung auf 0 setzen, wenn keine Entladung stattfindet
$this->SetValue("AktuelleEntladeleistung", 0); $this->SetValue("AktuelleEntladeleistung", 0);
} }
} }
// Überprüfen, ob die Ladeleistung-ID korrekt gesetzt ist
if ($ladeleistungID > 0) { if ($ladeleistungID > 0) {
if ($power >= 0) { if ($power >= 0) {
// Ladeleistung setzen (wenn power positiv ist)
$this->SetValue("AktuelleLadeleistung", $power); $this->SetValue("AktuelleLadeleistung", $power);
$this->SetValue("AktuelleEntladeleistung", 0); // Entladeleistung auf 0 setzen $this->SetValue("AktuelleEntladeleistung", 0);
} else { } else {
// Ladeleistung auf 0 setzen, wenn keine Aufladung stattfindet
$this->SetValue("AktuelleLadeleistung", 0); $this->SetValue("AktuelleLadeleistung", 0);
} }
} }*/
// Prüfe auf Änderung der Leistung im Vergleich zur letzten Einstellung // Prüfe auf Änderung der Leistung im Vergleich zur letzten Einstellung

View File

@@ -6,7 +6,7 @@
"compatibility": { "compatibility": {
"version": "7.1" "version": "7.1"
}, },
"version": "1.058", "version": "1.059",
"build": 0, "build": 0,
"date": 0 "date": 0
} }