Phue\Client::sendCommand PHP Method

sendCommand() public method

Send command to server
public sendCommand ( Phue\Command\CommandInterface $command ) : mixed
$command Phue\Command\CommandInterface Phue command
return mixed Command result
    public function sendCommand(CommandInterface $command)
    {
        return $command->send($this);
    }

Usage Example

Example #1
0
 /**
  * Adjust individual light
  *
  * @param $id
  * @param $brightness
  * @return array
  */
 public function adjustLight($id, $brightness)
 {
     try {
         $light = $this->client->sendCommand(new \Phue\Command\GetLightById($id));
         $light->setOn(true);
         $command = new \Phue\Command\SetLightState($light);
         $command->brightness($brightness);
         $this->client->sendCommand($command);
         return array('command' => true);
     } catch (\Exception $e) {
         dd($e);
         return array('command' => $e->getMessage());
     }
 }
All Usage Examples Of Phue\Client::sendCommand