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($id, $action) { if ($id == "timer") { $_SESSION["BPS"]->setProperty("mFhemTimer", "FhemValue", $action); return; } $F = new Fhem($id); $S = new FhemServer($F->A("FhemServerID")); 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->getA()->FhemServerIP . " could not be established!'"); } $T->fireAndForget("set " . $F->A("FhemName") . " {$action}"); $T->disconnect(); break; case "1": $S->setDevice($F->getID(), $action); #$url = $S->A("FhemServerURL")."?device=".$F->A("FhemName")."&value=".$action; #echo "opening URL $url..."; #fopen($url, "r"); break; } }