no message

This commit is contained in:
2025-05-02 15:12:52 +02:00
parent 08498c2a75
commit ab1f362a45

View File

@@ -88,6 +88,20 @@ class Verbraucher_extern extends IPSModule
}
private function findCombination($power, $values) {
$result = [];
$found = findCombinationRecursive($power, $values, [], 0, $result);
return $found ? $result : null;
}
private function findCombinationRecursive($power, $values, $currentCombination, $startIndex, &$result) {
if ($power == 0) {
$result = $currentCombination;
return true;
}
if ($power < 0) {
return false;
private function find($target, $values, $current, &$result) {
if ($target == 0) {
$result[] = $current;
@@ -106,15 +120,17 @@ class Verbraucher_extern extends IPSModule
{
$values = json_decode($this->GetValue("PowerSteps"));
$result = [];
$this->find($this->GetValue("Power"), $values, [], $result);
$firstCombination = $this->findCombination($this->GetValue("Power"), $this->GetValue("PowerSteps"));
//$this->find($this->GetValue("Power"), $values, [], $result);
$verbraucherListe = json_decode($this->ReadPropertyString("Verbraucher_Liste"), true);
$firstCombination = $result[0];
//$firstCombination = $result[0];
foreach ($verbraucherListe as &$verbraucher) {
foreach ($verbraucherListe as $verbraucher) {
if (in_array($verbraucher['P_Nenn'], $firstCombination)) {
RequestAction($verbraucher['Write_Var'], false);
} else {