Beispiel #1
0
 public function alloffAction()
 {
     require_once 'models/homeModel.php';
     $model = new homeModel();
     $lights = $model->getDeviceOn();
     foreach ($lights as $light) {
         $stat = "0";
         $letter = $this->letter($light['letter']);
         // execute rcswitch-pi
         $output = shell_exec('sudo /home/pi/rcswitch-pi/send ' . $light['code'] . ' ' . $letter . ' ' . $stat . ' ');
         //echo $output;
         // Set device status
         $model->setDeviceStatus($light['id'], $stat);
     }
     echo 1;
 }