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;
 }
Exemple #2
0
 public function getListXML()
 {
     $T = new Telnet($this->A("FhemServerIP"), $this->A("FhemServerPort"));
     $T->setPrompt("</FHZINFO>");
     return $T->fireAndGet("xmllist") . "</FHZINFO>";
 }