상속: implements Phue\Command\CommandInterface, implements Phue\Command\SchedulableInterface
예제 #1
0
 /**
  * Test: Get schedulable params
  *
  * @covers \Phue\Command\SetLightState::getSchedulableParams
  */
 public function testGetSchedulableParams()
 {
     // Build command
     $setLightStateCmd = new SetLightState($this->mockLight);
     // Change alert
     $setLightStateCmd->alert('select');
     // Ensure schedulable params are expected
     $this->assertEquals(['address' => "/api/{$this->mockClient->getUsername()}/lights/{$this->mockLight->getId()}/state", 'method' => 'PUT', 'body' => (object) ['alert' => 'select']], $setLightStateCmd->getSchedulableParams($this->mockClient));
 }
예제 #2
0
 /**
  * Test: Get actionable params
  *
  * @covers \Phue\Command\SetLightState::getActionableParams
  */
 public function testGetActionableParams()
 {
     // Build command
     $setLightStateCmd = new SetLightState($this->mockLight);
     // Change alert
     $setLightStateCmd->alert('select');
     // Ensure actionable params are expected
     $this->assertEquals(array('address' => "/lights/{$this->mockLight->getId()}/state", 'method' => 'PUT', 'body' => (object) array('alert' => 'select')), $setLightStateCmd->getActionableParams($this->mockClient));
 }
예제 #3
0
파일: Light.php 프로젝트: sqmk/phue
 /**
  * Set Color temperature
  *
  * @param int $value Color temperature value
  *
  * @return self This object
  */
 public function setColorTemp($value)
 {
     $x = new SetLightState($this);
     $y = $x->colorTemp((int) $value);
     $this->client->sendCommand($y);
     // Change both internal color temp and colormode state
     $this->attributes->state->ct = (int) $value;
     $this->attributes->state->colormode = 'ct';
     return $this;
 }