Entenzähler im WebFront

Hallo, kann mir mal jemand helfen das Entenzählerscript so umzubauen das ich es nutzen kann um eine Temperatur ein zu stellen von min 15°C und max 28°C

Bekomm das einfach nicht hin habe mit PHP zu wenig erfahrung.

Danke

Markus

Habe es so weit hinbekommen bis auf das ich gerne in 0,5 er schritten schalten würde.

Markus

dann poste doch mal dein aktuelles Skript

$ProfileName = 'StockManagement';

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 + 17, min($maxValue - 1, $value)));
}

Hallo,

mit diesem Skript sollte es funktionieren.
Du muesstest jedoch eine zusaetzliche Variable ($T) einfuegen.

Gruesse Wickie


<?
$ProfileName = 'StockManagement';

$minValue = 15;
$maxValue = 28;
$dT = 0.5;
$ID_T = 51118;  // ID Temperaturvariablen
$T = GetValue($ID_T);

$profile = IPS_GetVariableProfile($ProfileName);

if (@IPS_GetVariableProfile($ProfileName) == false && IPS_CreateVariableProfile($ProfileName, 1))
   { // Variablen-Profil anlegen, wenn es noch nicht besteht
            IPS_SetVariableProfileAssociation($ProfileName, -1, '<', '', -1);
            IPS_SetVariableProfileAssociation($ProfileName, 0, 20, '', -1);
            IPS_SetVariableProfileAssociation($ProfileName, 1, '>', '', -1);
   }
else {}

if ($IPS_SENDER === 'WebFront')
	{
    $value = $T;
    if ($IPS_VALUE == -1)
    {
            $value = max($value - $dT,$minValue);
    }
    else if ($IPS_VALUE == 1)
    {
          $value =  min($value + $dT,$maxValue);
    }
    

	$value = number_format($value, 1, ',', '.');

	IPS_SetVariableProfileAssociation($ProfileName, -1, '<', '', -1);
	IPS_SetVariableProfileAssociation($ProfileName, 0, $value, '', -1);
	IPS_SetVariableProfileAssociation($ProfileName, 1, '>', '', -1);
	SetValue($ID_T, $value);
}


?>

Hallo, sorry das ich mich erst jetzt melde aber was meinst du mit Variable $T einfügen?

Also wenn ich als $dT=1 einsetze dann geht es aber mit 0.5 zählt er nur von 19,5 auf 20,5.

Markus

Hallo Leute,

hier mal meine Anpassungen für eine Temperatur-Sollwertvorgabe:

<?php
/*
Zur Installation das Skript einmal ausführen und nach belieben
Float-Variablen mit Variablenprofil 'TempManagement' und
diesem Skript als Aktionsskript erstellen.
*/

$ProfileName = 'TempManagement';
$minTemp = 15; //ggf. anpassen
$maxTemp = 25; //ggf. anpassen


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

    $value = GetValueFloat($IPS_VARIABLE);

	 if ($IPS_VALUE == $minValue)
    {
        $value = $value - .5;
    }
    else if ($IPS_VALUE == $maxValue)
    {
        $value = $value + .5;
    }

    SetValue($IPS_VARIABLE, max($minTemp, min($maxTemp, $value)));
}
else
{
    IPS_SetHidden($IPS_SELF, true);

    if (@IPS_GetVariableProfile($ProfileName) === false && IPS_CreateVariableProfile($ProfileName, 2))
    {
		  IPS_SetVariableProfileDigits($ProfileName, 1);

		  if (floatval(IPS_GetKernelVersion()) >= 2.4)
        {
				IPS_SetVariableProfileAssociation($ProfileName, -1, '<', '', -1);
            IPS_SetVariableProfileAssociation($ProfileName, 0, '%.1f °C', '', -1);
            IPS_SetVariableProfileAssociation($ProfileName, 101, '>', '', -1);
        }
        else
		  {
				IPS_SetVariableProfileAssociation($ProfileName, -1, '<', '');
            IPS_SetVariableProfileAssociation($ProfileName, 0, '%.1f °C', '');
            IPS_SetVariableProfileAssociation($ProfileName, 101, '>', '');
        }
    }
}
?>

…ich habe mir da ziemlich lange dran gebastelt - so am Anfang sooo einfach aus (der Teufel steckt manchmal im Detail)…

Joachim

Nachtrag: Bei der Benutzung im iFront wird eine größere Temperaturumstellung sehr mühselig, da ist die „klassische“ Bedienung dann doch angenehmer. Im Webfront hingegen wird das Feld deutlich kürzer in wirkt damit aufgeräumter…

Super danke für die Mühe, genau das was ich gesucht habe

Markus

Hallo zusammen,

ich habe das Skript zur Temperatur-Einstellung bei mir eingepflegt.
Im Webfront erscheint der Entenzähler auch.
Wenn ich ihn betätigen möchte, erhalte ich jedoch verschiedene Fehler, aus denen ich trotz Google und Fourm nicht schlau werde. Kann da jemand helfen?

16.06.2016 18:16:35*| VariableManager*| [Program\IPSLibrary\data\core\IPSLogger\IPSLogger\HtmlOut_MsgList] = <style>.row-highlight tr:hover {
                             background-color: rgba(255, 255, 255, 0.1) !important;
                             color:#808080 !important;}</style>
                        <table width="100%" class="row-highlight" style="font-family:courier; font-size:11px;"><colgroup><col width="25px"><col width="40px"><col width="100px"><col width="200px"><col></colgroup><tr id="2298" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 16:20:49.494</td><td><DIV>Warning: Variable is marked as read-only and cannot be changed<BR>    Error in Script - on Line 1<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>     1 in - (call SetValueBoolean)</DIV></td></tr><tr id="2299" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 16:38:13.614</td><td><DIV>Warning: Variable is marked as read-only and cannot be changed<BR>    Error in Script - on Line 1<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>     1 in - (call SetValueBoolean)</DIV></td></tr><tr id="2300" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 16:55:37.830</td><td><DIV>Warning: Variable is marked as read-only and cannot be changed<BR>    Error in Script - on Line 1<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>     1 in - (call SetValueBoolean)</DIV></td></tr><tr id="2301" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 17:13:01.991</td><td><DIV>Warning: Variable is marked as read-only and cannot be changed<BR>    Error in Script - on Line 1<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>     1 in - (call SetValueBoolean)</DIV></td></tr><tr id="2302" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 17:30:26.180</td><td><DIV>Warning: Variable is marked as read-only and cannot be changed<BR>    Error in Script - on Line 1<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>     1 in - (call SetValueBoolean)</DIV></td></tr><tr id="2303" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 17:56:07.594</td><td><DIV>Notice: Undefined variable: IPS_SENDER<BR>    Error in Script /mnt/data/symcon/scripts/16313.ips.php on Line 12<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    12 in /mnt/data/symcon/16313.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2304" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 17:56:07.607</td><td><DIV>Notice: Undefined variable: IPS_SELF<BR>    Error in Script /mnt/data/symcon/scripts/16313.ips.php on Line 32<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    32 in /mnt/data/symcon/16313.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2305" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 17:56:07.621</td><td><DIV>Warning: Root kann nicht geändert werden <BR>    Error in Script /mnt/data/symcon/scripts/16313.ips.php on Line 32<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>    32 in /mnt/data/symcon/16313.ips.php (call IPS_SetHidden)</DIV></td></tr><tr id="2306" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:10:40.180</td><td><DIV>Notice: Undefined variable: IPS_SENDER<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 13<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    13 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2307" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:10:40.193</td><td><DIV>Notice: Undefined variable: IPS_SELF<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2308" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:10:40.206</td><td><DIV>Warning: Root kann nicht geändert werden <BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPS_SetHidden)</DIV></td></tr><tr id="2309" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:11:51.681</td><td><DIV>Notice: Undefined variable: IPS_SENDER<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 13<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    13 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2310" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:11:51.694</td><td><DIV>Notice: Undefined variable: IPS_SELF<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2311" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:11:51.707</td><td><DIV>Warning: Root kann nicht geändert werden <BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPS_SetHidden)</DIV></td></tr><tr id="2312" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:16:15.608</td><td><DIV>Notice: Undefined variable: IPS_SENDER<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 13<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    13 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2313" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:16:15.621</td><td><DIV>Notice: Undefined variable: IPS_SELF<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2314" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:16:15.635</td><td><DIV>Warning: Root kann nicht geändert werden <BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPS_SetHidden)</DIV></td></tr><tr id="2315" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:16:35.411</td><td><DIV>Notice: Undefined variable: IPS_SENDER<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 13<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    13 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2316" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:16:35.424</td><td><DIV>Notice: Undefined variable: IPS_SELF<BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    44 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPSLogger_PhpErrorHandler)</DIV></td></tr><tr id="2317" style="color:#000000;background:#FF0000;"><td>IPS</td><td>-Err-</td><td title="PHP">PHP</td><td>2016-06-16 18:16:35.438</td><td><DIV>Warning: Root kann nicht geändert werden <BR>    Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34<BR>   134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)<BR>    37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)<BR>       in IPSLogger_PhpErrorHandler<BR>    34 in /mnt/data/symcon/21316.ips.php (call IPS_SetHidden)</DIV></td></tr></table>

und

16.06.2016 18:16:35*| PHP*| Error: Warning: Root kann nicht geändert werden 
   Error in Script /mnt/data/symcon/scripts/21316.ips.php on Line 34
  134 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger.inc.php (call IPSLogger_Out)
   37 in /mnt/data/symcon/IPSLibrary/app/core/IPSLogger/IPSLogger_PhpErrorHandler.inc.php (call IPSLogger_Err)
      in IPSLogger_PhpErrorHandler
   34 in /mnt/data/symcon/21316.ips.php (call IPS_SetHidden)

Das Skript 21316 ist das Entenzähler Skript.