Propertys Variable probleme
This commit is contained in:
@@ -16,6 +16,7 @@ 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("Ladestrom", "Ladestrom", "", 0);
|
||||||
$this->RegisterVariableFloat("Entladestrom", "Entladestrom", "", 0);
|
$this->RegisterVariableFloat("Entladestrom", "Entladestrom", "", 0);
|
||||||
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
|
$this->RegisterVariableInteger("Aktuelle_Leistung", "Aktuelle_Leistung", "", 0);
|
||||||
@@ -28,7 +29,8 @@ class Batterie extends IPSModule
|
|||||||
|
|
||||||
|
|
||||||
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
|
$this->RegisterVariableFloat("Bezogene_Energie", "Bezogene_Energie", "", 0);
|
||||||
|
$this->RegisterVariableFloat("AktuelleLadeleistung", "Aktuelle Ladeleistung", "", 0);
|
||||||
|
$this->RegisterVariableFloat("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);
|
||||||
@@ -92,36 +94,34 @@ public function RequestAction($Ident, $Value)
|
|||||||
public function SetAktuelle_Leistung(int $power)
|
public function SetAktuelle_Leistung(int $power)
|
||||||
{
|
{
|
||||||
|
|
||||||
$ladeleistung = $this->ReadPropertyFloat("Ladeleistung");
|
// Ausgewählte Variablen aus der Instanzkonfiguration lesen
|
||||||
$entladeleistung = $this->ReadPropertyFloat("Entladeleistung");
|
$entladeleistungID = $this->ReadPropertyInteger("Entladeleistung");
|
||||||
|
$ladeleistungID = $this->ReadPropertyInteger("Ladeleistung");
|
||||||
if ($power >= 0) {
|
|
||||||
SetValue($this->ReadPropertyFloat("Ladeleistung"), $power);
|
|
||||||
} else {
|
|
||||||
SetValue($this->ReadPropertyFloat("Entladeleistung"),abs($power));
|
|
||||||
}
|
|
||||||
|
|
||||||
$spannung = $this->ReadPropertyInteger("Batteriespannung");
|
|
||||||
//$ladestrom = GetValue($this->GetIDForIdent("Ladestrom"));
|
|
||||||
//$entladestrom = GetValue($this->GetIDForIdent("Entladestrom"));
|
|
||||||
$ladestrom = $this->ReadPropertyFloat("Ladestrom");
|
|
||||||
$entladestrom = $this->ReadPropertyFloat("Entladestrom");
|
|
||||||
|
|
||||||
|
|
||||||
if ($spannung <= 0) {
|
// Überprüfen, ob die Entladeleistung-ID korrekt gesetzt ist
|
||||||
IPS_LogMessage("Batterie", "Fehler: Batteriespannung ist 0 oder ungültig.");
|
if ($entladeleistungID > 0) {
|
||||||
return;
|
if ($power < 0) {
|
||||||
|
// Entladeleistung setzen (wenn power negativ ist)
|
||||||
|
$this->SetValue("AktuelleEntladeleistung", abs($power));
|
||||||
|
$this->SetValue("AktuelleLadeleistung", 0); // Ladeleistung auf 0 setzen
|
||||||
|
} else {
|
||||||
|
// Ladeleistung auf 0 setzen, wenn keine Entladung stattfindet
|
||||||
|
$this->SetValue("AktuelleEntladeleistung", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($power >= 0) {
|
// Überprüfen, ob die Ladeleistung-ID korrekt gesetzt ist
|
||||||
$ladestrom = $power / $spannung;
|
if ($ladeleistungID > 0) {
|
||||||
$this->SetValue("Ladestrom", $ladestrom);
|
if ($power >= 0) {
|
||||||
$this->SetValue("Entladestrom", 0);
|
// Ladeleistung setzen (wenn power positiv ist)
|
||||||
} else {
|
$this->SetValue("AktuelleLadeleistung", $power);
|
||||||
$entladestrom = $power / $spannung;
|
$this->SetValue("AktuelleEntladeleistung", 0); // Entladeleistung auf 0 setzen
|
||||||
$this->SetValue("Entladestrom", $entladestrom);
|
} else {
|
||||||
$this->SetValue("Ladestrom", 0);
|
// Ladeleistung auf 0 setzen, wenn keine Aufladung stattfindet
|
||||||
|
$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
|
||||||
$lastPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
$lastPower = GetValue($this->GetIDForIdent("Aktuelle_Leistung"));
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "7.1"
|
"version": "7.1"
|
||||||
},
|
},
|
||||||
"version": "1.048",
|
"version": "1.049",
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"date": 0
|
"date": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user