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()
{
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)
{
switch ($Ident) {
case "SetAktuelle_Leistung":
$this->SetAktuelle_Leistung($Value);
@@ -60,11 +65,11 @@ class Batterie extends IPSModule
}
public function SetAktuelle_Leistung(int $power)
{
{
// Batterie-spezifische Eigenschaften abrufen
$spannung = $this->ReadPropertyInteger("Batteriespannung");
$entladestrom = $this->ReadPropertyInteger("Entladestrom"));
$ladestrom = $this->ReadPropertyInteger("Ladestrom"));
$entladestrom = $this->ReadPropertyInteger("Entladestrom");
$ladestrom = $this->ReadPropertyInteger("Ladestrom");
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
// Batterie entladen oder laden basierend auf der Leistung
@@ -97,9 +102,10 @@ class Batterie extends IPSModule
public function GetCurrentData(bool $Peak)
{
// Werte der registrierten Variablen abrufen und in Variablen speichern
$aufdasnachladen =$this->ReadPropertyInteger("AufdasNachladen"));
$minimumentladen = $this->ReadPropertyInteger("MinimumEntladen"));
$batterieladezustand = $this->ReadPropertyInteger("Batterieladezustand"));
$array_powersteps = $this->GeneratePowerSteps();
$aufdasnachladen =$this->ReadPropertyInteger("AufdasNachladen");
$minimumentladen = $this->ReadPropertyInteger("MinimumEntladen");
$batterieladezustand = $this->ReadPropertyInteger("Batterieladezustand");
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
if ($Peak) {

View File

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