Powerstep waren nicht immer Arrays

This commit is contained in:
belevo\mh
2025-02-24 10:51:05 +01:00
parent 93707c5de2
commit 0899a6d58a
2 changed files with 8 additions and 4 deletions

View File

@@ -141,7 +141,7 @@ public function RequestAction($Ident, $Value)
$aufdasnachladen = $this->ReadPropertyInteger("AufdasNachladen");
$minimumentladen = $this->ReadPropertyInteger("MinimumEntladen");
$maxleistung = $this->ReadPropertyInteger("MaxBatterieleistung");
$dummy_array = [];
$batterieladezustandID = $this->ReadPropertyInteger("Batterieladezustand");
if ($batterieladezustandID > 0) {
$batterieladezustand = GetValue($batterieladezustandID);
@@ -172,14 +172,18 @@ public function RequestAction($Ident, $Value)
} else {
$this->SetValue("PowerSteps", json_encode($array_powersteps[0]));
$dummy_array = $array_powersteps[0];
$this->SetValue("PowerSteps", json_encode($dummy_array));
}
} else { // Solar
if ($batterieladezustand <= $minimumentladen) {
$this->SetValue("PowerSteps", max($array_powersteps));
$dummy_array = max($array_powersteps);
$this->SetValue("PowerSteps", json_encode($dummy_array));
} else {
$filtered_powersteps = array_filter($array_powersteps, function ($value) use ($maxleistung) {
return $value >= 0; // Hochpass filtern

View File

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