Phue\Command\SetGroupAttributes::lights PHP Method

lights() public method

Set lights
public lights ( array $lights ) : self
$lights array List of light Ids or Light objects
return self This object
    public function lights(array $lights)
    {
        $lightList = array();
        foreach ($lights as $light) {
            $lightList[] = (string) $light;
        }
        $this->attributes['lights'] = $lightList;
        return $this;
    }

Usage Example

Example #1
0
File: Group.php Project: sqmk/phue
 /**
  * Set lights
  *
  * @param array $lights
  *            Light ids or Light objects
  *
  * @return self This object
  */
 public function setLights(array $lights)
 {
     $lightIds = array();
     foreach ($lights as $light) {
         $lightIds[] = (string) $light;
     }
     $x = new SetGroupAttributes($this);
     $y = $x->lights($lightIds);
     $this->client->sendCommand($y);
     $this->attributes->lights = $lightIds;
     return $this;
 }