예제 #1
0
 public function activate()
 {
     /*$ac = new anyC();
     		$ac->setCollectionOf("FhemPreset");
     		$ac->addJoinV3("FhemServer","FhemPresetServerID","=","FhemServerID");
     		$ac->addAssocV3("FhemPresetID", "=", $PresetID);
     		$S = $ac->getNextEntry();*/
     $S = new FhemServer($this->A("FhemPresetServerID"));
     switch ($S->A("FhemServerType")) {
         case "0":
             try {
                 $T = new Telnet($S->A("FhemServerIP"), $S->A("FhemServerPort"));
             } catch (NoServerConnectionException $e) {
                 die("error:'The connection to the server with IP-address " . $S->A("FhemServerIP") . " could not be established!'");
             }
             $c = "set " . $this->A("FhemPresetName") . " on";
             $T->fireAndForget($c);
             $T->disconnect();
             break;
         case "1":
             $ac = new anyC();
             $ac->setCollectionOf("FhemEvent");
             $ac->addAssocV3("FhemEventPresetID", "=", $this->ID);
             $ac->lCV3();
             while ($E = $ac->getNextEntry()) {
                 $S->setDevice($E->A("FhemEventFhemID"), $E->A("FhemEventAction"));
             }
             break;
     }
 }
예제 #2
0
 public function resetServers()
 {
     $S = new mFhemServerGUI();
     $t = new HTMLTable(2, "Telnet-Commands");
     while ($s = $S->getNextEntry()) {
         $T = new Telnet($s->getA()->FhemServerIP, $s->getA()->FhemServerPort);
         $T->fireAndForget("rereadcfg");
         $t->addRow(array($s->getA()->FhemServerIP, "rereadcfg"));
     }
     echo $t;
 }