/**
* Send command
*
* @param Client $client
* Phue Client
*
* @return int Schedule Id
*/
public function send(Client $client)
{
// Set command attribute if passed
if ($this->command) {
$params = $this->command->getActionableParams($client);
$params['address'] = "/api/{$client->getUsername()}" . $params['address'];
$this->attributes['command'] = $params;
}
// Set time attribute if passed
if ($this->time) {
$this->attributes['time'] = (string) $this->time;
}
// Create schedule
$scheduleId = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/schedules", TransportInterface::METHOD_POST, (object) $this->attributes);
return $scheduleId;
}