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); }
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; } }
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; } }
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; }