no message
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user