Beispiel #1
0
 public function isOn()
 {
     $size = count($this->lights);
     $hue = new Hue();
     if ($size != 1) {
         $status = array_fill(0, $size, false);
         for ($i = 0; $i < $size; $i++) {
             $light = $this->lights[$i];
             $protocol = $light['protocol'];
             switch ($protocol) {
                 case 'hue':
                     $uid = $light['uid'];
                     $status[$i] = $hue->isOn($uid);
                     break;
             }
         }
         return $status;
     }
     $light = $this->lights[0];
     $protocol = $light['protocol'];
     switch ($protocol) {
         case 'hue':
             $uid = $light['uid'];
             return $hue->isOn($uid);
     }
 }