Wo ist der Fehler ? :)

Hallo Gemeinde,

zu beginn: Vorsicht, php Anfänger ! :slight_smile:

Ich würde gerne eine Variable im Webfront dazu nutzen, um eine andere Variable jeweils um einen Wert höher oder tiefer zu schalten.

Leider wird die 2. Variable nicht verändert :frowning: (Also einen Wert rauf, bzw. runter)

Was mache ich hier denn schon wieder falsch ? :slight_smile:

hier mein Ansatz :

<?

    $actual = GetValueInteger(18494 /*[Mein Haus\Wohnzimmer\Licht\fade]*/);
    $plus = $actual+1;
    $minus = $actual-1;
    

if ($IPS_SENDER == "Execute")
{
    echo "Dieses Script kann nicht von Hand gestartet werden.";
    return;
}
if ($IPS_SENDER == "WebFront")
{
    SetValue(55658 /*[Mein Haus\Wohnzimmer\Licht\fadeplusminus]*/, $IPS_VALUE);
} else {
 echo "Dieses Skript kann nur vom WebFront aus gestartet werden!";
}

if ($IPS_VALUE == 0)
{
   SetValueInteger(18494 /*[Mein Haus\Wohnzimmer\Licht\fade]*/, $minus);

}

if ($IPS_VALUE == 1)
{
   SetValueInteger(18494 /*[Mein Haus\Wohnzimmer\Licht\fade]*/, $plus);
}

?>

Vielen Lieben Dank für „drübersehen“

Gruß
Sascha

Vielleicht ist das was für dich http://www.ip-symcon.de/forum/threads/14121-Entenzähler-im-WebFront

Vielen Dank,

das sieht in der Tat sehr interessant aus !!!

Damit probiere ich es einmal.

Danke nochmal :slight_smile:

Sooo…fast geschafft…der Entenzähler ist wirklich spitze.

Ein Problem noch:

ich bräuchte eine Schrittweite von 10…nicht nur von 1.

Leider hat das verändern im Script von „-1“ und „+1“ zu „-10“ und „+10“ nichts gebracht :frowning:

Hat da noch jemand eine idee ?

<?php
/*
Lagerbestandsverwaltung

Zur Installation das Skript einmal ausführen und nach belieben
Integer-Variablen mit Variablenprofil 'StockManagement' und
diesem Skript als Aktionsskript erstellen.
*/

$ProfileName = 'StockManagement2';

if ($IPS_SENDER === 'WebFront')
{
    $profile = IPS_GetVariableProfile($ProfileName);
    $minValue = (int)$profile['Associations'][0]['Value'];
    $maxValue = (int)$profile['Associations'][2]['Value'];

    $value = GetValue($IPS_VARIABLE);
    if ($IPS_VALUE == $minValue)
    {
        $value--;
    }
    else if ($IPS_VALUE == $maxValue)
    {
        $value++;
    }

    SetValue($IPS_VARIABLE, max($minValue + 1, min($maxValue - 1, $value)));
}
else
{
    IPS_SetHidden($IPS_SELF, true);

    if (@IPS_GetVariableProfile($ProfileName) === false && IPS_CreateVariableProfile($ProfileName, 1))
    {
        if (floatval(IPS_GetKernelVersion()) >= 2.4)
        {
            IPS_SetVariableProfileAssociation($ProfileName, -1, '<', '', -1);
            IPS_SetVariableProfileAssociation($ProfileName, 0, '%d', '', -1);
            IPS_SetVariableProfileAssociation($ProfileName, 101, '>', '', -1);
        }
        else
        {
            IPS_SetVariableProfileAssociation($ProfileName, -1, '<', '');
            IPS_SetVariableProfileAssociation($ProfileName, 0, '%d', '');
            IPS_SetVariableProfileAssociation($ProfileName, 101, '>', '');
        }
    }
}
?>