Exemple #1
0
 // Get lights
 $lights = $client->sendCommand(new \Phue\Command\GetLights());
 // Declare light properties:
 $oldBrightness = new ArrayObject();
 $oldHue = new ArrayObject();
 $oldSaturation = new ArrayObject();
 foreach ($lights as $lightId => $light) {
     $oldBrightness[$lightId] = $light->getBrightness();
     $oldHue[$lightId] = $light->getHue();
     $oldSaturation[$lightId] = $light->getSaturation();
 }
 $sweepTime = 1;
 $group = $client->getGroups();
 $redcommand = new \Phue\Command\SetGroupState($group);
 $redcommand->brightness(166)->hue(39684)->saturation(255);
 $redcommand->transitionTime($sweepTime);
 $darkcommand = new \Phue\Command\SetGroupState($group);
 $darkcommand->brightness(0)->transitionTime($sweepTime);
 for ($i = 1; $i <= 5; $i++) {
     $client->sendCommand($redcommand);
     sleep($sweepTime);
     $client->sendCommand($darkcommand);
     sleep($sweepTime);
 }
 foreach ($lights as $lightId => $light) {
     $oldCommand = new \Phue\Command\SetLightState($light);
     $oldCommand->brightness($oldBrightness[$lightId])->hue($oldHue[$lightId])->saturation($oldSaturation[$lightId])->transitionTime(0);
     $client->sendCommand($oldCommand);
 }
 //On
 //Living Room
Exemple #2
0
     $oldSaturation[$lightId] = $light->getSaturation();
 }
 $sweepTime = 1;
 $group = $client->getGroups();
 $blackcommand = new \Phue\Command\SetGroupState($group);
 $blackcommand->brightness(0)->transitionTime($sweepTime);
 $client->sendCommand($blackcommand);
 $hueGroup = $client->getGroups(3);
 $redcommand = new \Phue\Command\SetGroupState($hueGroup);
 $redcommand->brightness(255);
 $redcommand->hue(150);
 $redcommand->saturation(255);
 $redcommand->transitionTime($sweepTime);
 $darkcommand = new \Phue\Command\SetGroupState($hueGroup);
 $darkcommand->brightness(0);
 $darkcommand->transitionTime($sweepTime);
 for ($i = 1; $i <= 10; $i++) {
     $client->sendCommand($redcommand);
     sleep($sweepTime);
     $client->sendCommand($darkcommand);
     sleep($sweepTime);
 }
 foreach ($lights as $lightId => $light) {
     $oldCommand = new \Phue\Command\SetLightState($light);
     $oldCommand->brightness($oldBrightness[$lightId])->hue($oldHue[$lightId])->saturation($oldSaturation[$lightId])->transitionTime(0);
     $client->sendCommand($oldCommand);
 }
 // On
 // Living Room
 shell_exec("curl http://Quinn064:MqC3oSUo@192.168.0.2:25105/3?026230D9270F11FF=I=3");
 sleep(1);