コード例 #1
0
ファイル: FhemServer.class.php プロジェクト: nemiah/fheME
 public function setDevice($fhemID, $action)
 {
     $F = new Fhem($fhemID);
     switch ($this->A("FhemServerType")) {
         case "1":
             if ($fhemID != -1) {
                 $url = $this->A("FhemServerURL") . "?device=" . $F->A("FhemName") . "&value=" . $action;
             } else {
                 $url = $this->A("FhemServerURL") . "?value=" . $action;
             }
             fopen($url, "r");
             break;
     }
 }
コード例 #2
0
ファイル: mFhemTimerGUI.class.php プロジェクト: nemiah/fheME
 public function getHTML($id)
 {
     $bps = $this->getMyBPSData();
     $t = new HTMLTable(1);
     $t->setTableStyle("width:160px;float:right;margin-right:10px;");
     if (!isset($bps["ID"])) {
         $F = new mFhemGUI();
         $F->addAssocV3("FhemType", "!=", "FHZ");
         while ($f = $F->getNextEntry()) {
             $B = new Button($f->getA()->FhemName, "./fheME/Fhem/fhem.png");
             $B->onclick("contentManager.loadFrame('contentRight','mFhemTimer',-1,0,'mFhemTimerGUI;ID:" . $f->getID() . ";type:D;name:" . $f->getA()->FhemName . "');");
             $t->addRow($B);
             $t->addRowClass("backgroundColor0");
         }
         $t->addRow("");
         $t->addRowClass("backgroundColor1");
         $F = new anyC();
         $F->setCollectionOf("FhemPreset");
         $F->addAssocV3("FhemPresetHide", "=", "0");
         while ($f = $F->getNextEntry()) {
             $B = new Button($f->getA()->FhemPresetName, "./fheME/Fhem/events.png");
             $B->onclick("contentManager.loadFrame('contentRight','mFhemTimer',-1,0,'mFhemTimerGUI;ID:" . $f->getID() . ";type:P;name:" . $f->getA()->FhemPresetName . "');");
             $t->addRow($B);
             $t->addRowClass("backgroundColor0");
         }
         return $t;
     }
     if (isset($bps["ID"])) {
         if ($bps["type"] == "D") {
             $F = new Fhem($bps["ID"]);
             $F->loadMe();
             $FF = new Fhem("timer");
             $FF->setA($F->getA());
             $C = new FhemControlGUI();
             $control = $C->getControl($FF);
         } else {
             $control = "";
         }
         $rand = rand(10, 10000000);
         $B = new Button("set timer", "okCatch");
         $B->rme("FhemControl", '', 'setTimer', array($bps["ID"], "'setBPSValue'", "'{$bps['type']}'", "parent.clock4Timer{$rand}.stunden", "parent.clock4Timer{$rand}.minuten", "'{$bps['name']}'"), "contentManager.loadFrame(\\'contentRight\\',\\'mFhem\\',-1,0,\\'\\');");
         $B->style("float:right;");
         $t->addRow("<iframe name=\"clock4Timer{$rand}\" style=\"width:240px;height:330px;border:0px;\" src=\"./libraries/ClockGUI.class.php\"></iframe>");
         $t->addRowClass("backgroundColor0");
         $t->addRow($B);
         $t->addRowClass("backgroundColor0");
         return $control . $t;
     }
 }
コード例 #3
0
ファイル: FhemHM.class.php プロジェクト: nemiah/fheME
 public static function icon($data, Fhem $F, Button $B)
 {
     switch ($F->A("FhemHMModel")) {
         case "HM-Sec-RHS":
             if ($data->attributes()->state == "open") {
                 $B->image("warning");
             }
             if ($data->attributes()->state == "closed") {
                 $B->image("bestaetigung");
             }
             if ($data->attributes()->state == "tilted") {
                 $B->image("notice");
             }
             break;
     }
 }
コード例 #4
0
ファイル: mFhemEventGUI.class.php プロジェクト: nemiah/fheME
 public static function ActionParser($w, $l, $p)
 {
     $s = HTMLGUI::getArrayFromParametersString($p);
     if ($s[2] == "-1") {
         $I = new HTMLInput("FhemEventAction", "multiInput", $w, array("FhemEvent", $s[0], "FhemEventAction"));
         $I->style("width:95%;text-align:left;");
         return $I;
     }
     $Fhem = new Fhem($s[1]);
     $Fhem->loadMe();
     $op = $Fhem->getAvailableOptions();
     $o = "<option value=\"\">select...</option>";
     foreach ($op as $k => $v) {
         $o .= "<option " . ($w == $v ? "selected=\"selected\"" : "") . " value=\"{$v}\">{$k}</option>";
     }
     return "<select onchange=\"rme('FhemEvent', '{$s['0']}', 'saveMultiEditField', Array('FhemEventAction',this.value), 'checkResponse(transport);');\">{$o}</select>";
 }
コード例 #5
0
ファイル: FhemPresetGUI.class.php プロジェクト: nemiah/fheME
 function addDevice($id)
 {
     $Fhem = new Fhem($id);
     $Fhem->loadMe();
     /*$test1 = new anyC();
     		$test1->setCollectionOf("FhemEvent");
     		$test1->addJoinV3("Fhem","FhemEventFhemID","=","FhemID");
     		$test1->addAssocV3("FhemEventPresetID","=",$this->ID);
     		$test1->addAssocV3("FhemServerID","!=",$Fhem->getA()->FhemServerID);
     		
     		if($test1->getNextEntry() != null) die("error:'You may only use devices connected to the same server!'");*/
     /*$test2 = new anyC();
     		$test2->setCollectionOf("FhemEvent");
     		$test2->addAssocV3("FhemEventPresetID","=",$this->ID);
     		$test2->addAssocV3("FhemEventFhemID","=",$id);
     		
     		if($test2->getNextEntry() != null) die("error:'Device already added!'");*/
     $FE = new FhemEvent(-1);
     $FEA = $FE->newAttributes();
     $FEA->FhemEventFhemID = $id;
     $FEA->FhemEventPresetID = $this->ID;
     $FE->setA($FEA);
     $FE->newMe(true, true);
 }
コード例 #6
0
ファイル: SieHabenPost.class.php プロジェクト: nemiah/fheME
 public function process(Fhem $F, $xml)
 {
     $state = $xml->attributes()->state;
     $stateText = "";
     $event = "\$j('#FhemControlID_" . $F->getID() . "').removeClass('highlight');";
     $FS = new Button("", "./images/i2/empty.png", "icon");
     $FS->style("float:left;margin-right:5px;width:32px;height:32px;");
     if ($state != "off" && $state != "aus") {
         $FS->image("./fheME/SieHabenPost/SieHabenPost.png");
         $stateText = "Sie haben Post!";
         $event = "\$j('#FhemControlID_" . $F->getID() . "').addClass('highlight');";
     }
     return "{$FS}<b>" . ($F->A("FhemAlias") == "" ? $F->A("FhemName") : $F->A("FhemAlias")) . "</b><br /><small style=\"color:grey;\">{$stateText}</small><div style=\"clear:both;\"></div>" . OnEvent::script($event);
 }
コード例 #7
0
ファイル: FhemControlGUI.class.php プロジェクト: nemiah/fheME
 private function getDeviceStatus($FhemID)
 {
     $F = new Fhem($FhemID);
     $S = new FhemServer($F->A("FhemServerID"));
     try {
         $T = new Telnet($S->A("FhemServerIP"), $S->A("FhemServerPort"));
         $T->setPrompt("</FHZINFO>");
         $answer = $T->fireAndGet("xmllist") . "</FHZINFO>";
     } catch (Exception $e) {
         return null;
     }
     $x = simplexml_load_string($answer);
     if (isset($x->FS20_LIST->FS20) and count($x->FS20_LIST->FS20) > 0) {
         foreach ($x->FS20_LIST->FS20 as $k => $v) {
             if ($v->attributes()->name != $F->A("FhemName")) {
                 continue;
             }
             return $v->attributes()->state;
         }
     }
     return null;
 }
コード例 #8
0
ファイル: FhemGUI.class.php プロジェクト: nemiah/fheME
 public function showData()
 {
     list($S, $I) = $this->getData();
     $TabS = new HTMLTable(3);
     $TabS->maxHeight(200);
     $TabI = new HTMLTable(2, "Int");
     $TabI->maxHeight(200);
     foreach ($S as $v) {
         $TabS->addRow($v);
     }
     foreach ($I as $v) {
         $TabI->addRow($v);
     }
     echo $TabS . $TabI;
     Fhem::disconnectAll();
 }