예제 #1
0
 public function fixIt()
 {
     $this->_telnet->setListener($this);
     $this->_telnet->connect($this->_host);
     while ($this->_continue) {
         $this->_network->dispatchStreams();
     }
 }
예제 #2
0
     echo "<p>addData()";
 }
 $c = $_GET['channel'];
 $t = $_GET['temp'];
 $h = $_GET['humidity'];
 addData($c, $t, $h);
 $t10 = $t / 10;
 $thnames = array(1 => "THAussen", 2 => "THSchlaf", 3 => "THAndreas", 4 => "THBad");
 $thName = $thnames[$c];
 if ($useTelnet) {
     if ($DEBUG) {
         print "<br>### using telnet ###<br>";
     }
     //send data to fhem
     $telnet = new Telnet('192.168.0.40', 7072);
     $result = $telnet->connect();
     if ($DEBUG) {
         print "<br>telnet connect: " . $result . "<br>";
     }
     //lueften_ja berechnen und setzen
     if ($result) {
         $telnet->exec('setreading ' . $thName . ' T ' . $t10 . "\r\n", $result);
         // NOTE: $result may contain newlines
         if ($DEBUG) {
             print $result;
         }
         $telnet->exec('setreading ' . $thName . ' H ' . $h . "\r\n", $result);
         if ($DEBUG) {
             print '<br>setreading: ' . $result . '<br';
         }
         // say Disconnect(0); to break the connection without explicitly logging out