Skip to content

Commit 2503ea2

Browse files
authored
Merge pull request #110 from jonofe/master
Bugfix + Added Alert() function for HUE groups
2 parents 6b8ebf3 + 3273bf9 commit 2503ea2

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎library/Phue/Command/CreateGroup.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ public function send(Client $client)
101101
;
102102

103103
$r = explode('/', $response->id);
104-
return $r[2];
104+
return $r[0];
105105
}
106106
}

‎library/Phue/Group.php‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,33 @@ public function setOn($flag = true)
169169
return $this;
170170
}
171171

172+
/**
173+
* Get alert
174+
*
175+
* @return string Alert mode
176+
*/
177+
public function getAlert()
178+
{
179+
return $this->attributes->action->alert;
180+
}
181+
/**
182+
* Set light alert
183+
*
184+
* @param string $mode
185+
* Alert mode
186+
*
187+
* @return self This object
188+
*/
189+
public function setAlert($mode = SetLightState::ALERT_LONG_SELECT)
190+
{
191+
$x = new SetGroupState($this);
192+
$y = $x->alert($mode);
193+
$this->client->sendCommand($y);
194+
$this->attributes->action->alert = $mode;
195+
return $this;
196+
}
197+
198+
172199
/**
173200
* Get brightness
174201
*

‎tests/Phue/Test/Command/CreateGroupTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function testSend()
121121
->
122122
// ->will($this->returnValue((object)['id' => '/path/5']));
123123
will($this->returnValue((object) array(
124-
'id' => '/path/5'
124+
'id' => '5'
125125
)));
126126

127127
// Send command and get response

0 commit comments

Comments
 (0)