div fehler,ka

This commit is contained in:
belevo\mh
2024-12-11 16:26:05 +01:00
parent 7a5d34f2e3
commit de7f8a02c5
2 changed files with 22 additions and 16 deletions

View File

@@ -32,22 +32,27 @@ class Batterie extends IPSModule
public function ApplyChanges() public function ApplyChanges()
{ {
parent::ApplyChanges(); parent::ApplyChanges();
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
$array_powersteps = [];
//Schrittgrösse
$stepSize = 250;
for ($i = 0; $i <= $maxleistung * 2; $i += $stepSize) {
$array_powersteps[] = $i;
}
} }
private function GeneratePowerSteps()
{
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
$array_powersteps = [];
$stepSize = 250; // Schrittgröße
// Erstellen der PowerSteps
for ($i = 0; $i <= $maxleistung * 2; $i += $stepSize) {
$array_powersteps[] = $i;
}
return $array_powersteps;
}
public function RequestAction($Ident, $Value) public function RequestAction($Ident, $Value)
{ {
switch ($Ident) { switch ($Ident) {
case "SetAktuelle_Leistung": case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value); $this->SetAktuelle_Leistung($Value);
@@ -60,11 +65,11 @@ class Batterie extends IPSModule
} }
public function SetAktuelle_Leistung(int $power) public function SetAktuelle_Leistung(int $power)
{ {
// Batterie-spezifische Eigenschaften abrufen // Batterie-spezifische Eigenschaften abrufen
$spannung = $this->ReadPropertyInteger("Batteriespannung"); $spannung = $this->ReadPropertyInteger("Batteriespannung");
$entladestrom = $this->ReadPropertyInteger("Entladestrom")); $entladestrom = $this->ReadPropertyInteger("Entladestrom");
$ladestrom = $this->ReadPropertyInteger("Ladestrom")); $ladestrom = $this->ReadPropertyInteger("Ladestrom");
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung"); $maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
// Batterie entladen oder laden basierend auf der Leistung // Batterie entladen oder laden basierend auf der Leistung
@@ -97,9 +102,10 @@ class Batterie extends IPSModule
public function GetCurrentData(bool $Peak) public function GetCurrentData(bool $Peak)
{ {
// Werte der registrierten Variablen abrufen und in Variablen speichern // Werte der registrierten Variablen abrufen und in Variablen speichern
$aufdasnachladen =$this->ReadPropertyInteger("AufdasNachladen")); $array_powersteps = $this->GeneratePowerSteps();
$minimumentladen = $this->ReadPropertyInteger("MinimumEntladen")); $aufdasnachladen =$this->ReadPropertyInteger("AufdasNachladen");
$batterieladezustand = $this->ReadPropertyInteger("Batterieladezustand")); $minimumentladen = $this->ReadPropertyInteger("MinimumEntladen");
$batterieladezustand = $this->ReadPropertyInteger("Batterieladezustand");
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung"); $maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
if ($Peak) { if ($Peak) {

View File

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