<?
//HINWEIS:
//~~~~~~~~
//Dieses Script richtet sicht automatisch ein, wenn es ausgeführt wird
//
//-> Es wird abhängig von der Tageszeit eine Variable gesetzt (0-3)
// 0 = 0-6
// 1 = 6-12
// 2 = 12-18
// 3 = 19-24
//-----------------------------------------------------------------------------
//Ab diesem Punkt muss nichts verändert werden
//-----------------------------------------------------------------------------
if($IPS_SENDER == "Execute")
{
$eventid = @IPS_GetEventIDByName("Timer", $IPS_SELF);
if($eventid === false)
{
$eventid = IPS_CreateEvent(1); //Cyclic
IPS_SetEventActive($eventid, true);
IPS_SetName($eventid, "Timer");
IPS_SetEventScript($eventid, $IPS_SELF);
IPS_SetEventCyclic($eventid, 0, 0, 0, 3, 6);
}
$variableid = @IPS_GetVariableIDByName("Daytime", $IPS_SELF);
if($variableid === false)
{
$variableid = IPS_CreateVariable(1);
IPS_SetName($variableid, "Daytime");
IPS_SetParent($variableid, $IPS_SELF);
}
}
SetValue(IPS_GetVariableIDByName("Daytime", $IPS_SELF), floor(date("H") / 6));
?>
Wenn das Skript ausgeführt wird, legt es einen Timer an der alle 6 Stunden startet und dann eine Variable mit der jeweiligen Tageszeit als Wert zwischen 0-3 in die Variable ablegt.
paresy