Einzelnen Beitrag anzeigen
  #3 (permalink)  
Alt 09.03.10, 16:59
bejay bejay ist offline
Junior Member
 
Registriert seit: Oct 2007
Beiträge: 8
Standard

Danke für die schnelle Antwort. Hier das Script:


PHP-Code:
<?


$id_sound 
36844  /*[Unser Haus\Obergeschoss\Wohnzimmer\HiFi TV\Media  Player Wohnzimmer]*/;
$id_flag 56678  // Integer-Variable
//$IPS_VALUE = Motion 4;
// Flag:
// 1  Motion 1
// 2  Motion 2
// 3  Motion 3
// 4  Motion 4
// 88 Time-Out
// 99 andere Richtung > hier Motion 5

    
if($IPS_SENDER == "TimerEvent"){
    
SetValue($id_flag88);
    
IPS_SetScriptTimer($IPS_SELF0);    // Timer-AUS
    
return;
}

$inbuf Trim($IPS_VALUE);
//$inbuf = "Motion 4";  // für ein Test

$data_1 IPS_GetScript($IPS_SELF);
$last_up_1 $data_1[LastExecute];
$deltaT_1 time() - $last_up_1;
//echo "Letzte Ausführung in sec. : $deltaT_1\n";

if ($deltaT_1 2){     // es X Sekunden bis zur nächsten Zone

    
$flag GetValue($id_flag);

    if (
$inbuf == "Motion 1"){
        if (
$flag == 0){
           
IPS_SetScriptTimer($IPS_SELF30 );    // Timer-An
           
SetValue($id_flag /*[Web Cam\AXIS Flur\Zone Flag]*/1);
           
WAC_SetVolume($id_sound ,80);
            
WAC_PlayFile($id_sound ,  IPS_GetKernelDir()."sounds\\zone1.wav");
           return;
        }
    }

    if (
$inbuf == "Motion 2"){
        if (
$flag == 1){
           
SetValue($id_flag2);
           
WAC_SetVolume($id_sound ,80);
            
WAC_PlayFile($id_sound ,  IPS_GetKernelDir()."sounds\\zone2.wav");
           return;
        }
    }

    if (
$inbuf == "Motion 3"){
        if (
$flag == 2){
           
SetValue($id_flag3);
           
WAC_SetVolume($id_sound ,80);
            
WAC_PlayFile($id_sound ,  IPS_GetKernelDir()."sounds\\zone3.wav");
            return;
        }
    }

    if (
$inbuf == "Motion 4"){
        if (
$flag == 3){
           
SetValue($id_flag4);
           
WAC_SetVolume($id_sound ,80);
            
WAC_PlayFile($id_sound ,  IPS_GetKernelDir()."sounds\\zone4.wav");
            
IPS_Sleep(2000);
            
WAC_PlayFile($id_sound ,  IPS_GetKernelDir()."sounds\\willkommen_zu_hause.wav");
            return;
        }
    }

    if (
$inbuf == "Motion 5"){
        
SetValue($id_flag99);
        return;
    }
}  
// Warte-Zeit bis zur nächsten Zone

?>

Geändert von RWN (09.03.10 um 17:15 Uhr)
Mit Zitat antworten