FS 20 Haussteuerrung = 0)); } function print_options($name, $device, $dimmable, $href) { echo ""; echo "$name"; echo "
"; echo ""; echo ""; echo ""; echo "
"; echo ""; echo "
"; } function generate_random() { $devices=array("dg.gang", "dg.wand", "dg.dusche", "dg.bad", "dg.reduit", "dg.eltern", "dg.kino", "og.gang", "og.bad.links", "og.bad.rechts", "og.bad.sterne", "og.bad.decke", "og.stefan.decke", "og.stefan.pult", "og.sandra.decke", "og.kind.r", "og.kind.l", "eg.sitzplatz", "eg.wohnzimmer", "eg.bar", "eg.tisch", "eg.decke", "eg.kueche", "eg.bahnlicht", "eg.bad", "eg.gang", "eg.og.treppe", "ug.gast", "ug.gast.dose", "ug.aussen", "ug.gang", "ug.eg.treppe"); #number of events (min - max) $event_min=isset($_GET['event_min']) ? $_GET['event_min'] : 5; $event_max=isset($_GET['event_max']) ? $_GET['event_max'] : 20; #maximum delay in minutes $delay_min=isset($_GET['delay_min']) ? $_GET['delay_min'] : 0; $delay_max=isset($_GET['delay_max']) ? $_GET['delay_max'] : 240; #minimum and maximum ontime in minutes $ontime_min=isset($_GET['ontime_min']) ? $_GET['ontime_min'] : 5; $ontime_max=isset($_GET['ontime_max']) ? $_GET['ontime_max'] : 60; $variant=isset($_GET['variant']) ? $_GET['variant'] : "onoff"; echo "

Random event generator (\"holiday-function\")

"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo "
Number of events:-"; echo ""; if ( $event_min > $event_max ) { echo " : min has to be <= max"; unset($_GET['random']); } if ( !is_posint($event_min)) { echo " : min has to be a integer"; unset($_GET['random']); } if ( !is_posint($event_max)) { echo " : max has to be a integer"; unset($_GET['random']); } echo "
Delay from now:-"; echo "Min."; if ( $delay_min > $delay_max ) { echo " : min has to be <= max"; unset($_GET['random']); } if ( !is_posint($delay_min)) { echo " : min has to be a integer"; unset($_GET['random']); } if ( !is_posint($delay_max)) { echo " : max has to be a integer"; unset($_GET['random']); } echo "
Time to keep on:-"; echo "Min."; if ( $ontime_min > $ontime_max ) { echo " : min has to be <= max"; unset($_GET['random']); } if ( !is_posint($ontime_min)) { echo " : min has to be a integer"; unset($_GET['random']); } if ( !is_posint($ontime_max)) { echo " : max has to be a integer"; unset($_GET['random']); } echo "
Varant: "; echo ""; echo "
"; echo "

"; if ( isset($_GET['random'])) { $event=rand($event_min, $event_max); echo "Just copy lines below into FHZ1000 command window"; echo "

";
    for($i=0; $i<$event; $i++) {
 
      $starttime=rand($delay_min, $delay_max);
      $hour=intval($starttime/60);
      $minute=intval($starttime%60);
      $second=rand(0,59);

      $ontime=rand($ontime_min, $ontime_max);

      $dev=$devices[array_rand($devices)];

      if ($variant == "oft") {
        printf("at +%02d:%02d:%02d set %s on-for-timer %d
", $hour, $minute, $second, $dev, $ontime); } elseif ($variant == "onoff") { $offtime=$starttime + $ontime; $hour_off=intval($offtime / 60); $minute_off=intval($offtime % 60); $second_off=rand(0,59); printf("at +%02d:%02d:%02d set %s on
", $hour, $minute, $second, $dev); printf("at +%02d:%02d:%02d set %s off
", $hour_off, $minute_off, $second_off, $dev); } } echo "
";
  }
}

?>


FS 20 Haussteuerrung

Quicklinks: EG Generic Random

EG


Send generic command:

", isset($_GET['generic']) ? $_GET['generic'] : ""); ?>

Last command

"; echo "
send:"; foreach($cmdline as $line) { echo "$line
"; } echo "
"; echo "

"; $fp = fsockopen("localhost", 7072, $errno, $errstr, 10); if (!$fp) { echo "$errstr ($errno)
\n"; } else { foreach($cmdline as $line) { fwrite($fp, $line."\n"); } echo "
";
    while (!feof($fp)) {
      echo htmlentities(fgets($fp));
    }
    echo "
"; fclose($fp); } echo "
"; } ?>