Schedules
Schedules provide the ability to trigger timed commands to groups or lights.
Create schedule
POST /api/<apikey>/schedules
Creates a new schedule.
Parameters
| Field | Type | Description | Required |
|---|---|---|---|
| name | String | The name of the new schedule. If the name already exists a number will be appended. | optional |
| description | String | The description of the schedule. | optional |
| command | Object | The command to execute when the schedule triggers. | required |
| command.address | String | The address of a light or group ressource | required |
| command.method | String | must be “PUT” | required |
| command.body | Object | The state that the light or group will activate when the schedule triggers | required |
| status | String (“enabled”|“disabled”) | Whether the schedule is enabled or disabled. Default is enabled. | optional |
| autodelete | Bool | If true the schedule will be deleted after triggered. Else it will be disabled. Default is true. | optional |
| time | String |
Time when the schedule shall trigger in UTC ISO 8601:2004 format.
The number after R of recurring timer determine the number of
repetitions of the timer. Not specifying a number means infinity.
|
required |
Example request data
{
"name": "blue moon",
"description": "Turns all lights blue",
"command": {
"address": "/api/8918fbad2100nag17ca1/groups/5/action",
"method": "PUT",
"body": { "on": true, "hue": 43000, "sat": 255 }
},
"time": "2013-07-29T09:30:00"
}Note The address in the command object must contain a
valid API key.
Response
HTTP/1.1 200 OK[ { "success": { "id": "3" } } ]Response fields
| Field | Type | Description |
|---|---|---|
| id | String | The unique identifier of the new schedule. |
Possible errors
Get all schedules
GET /api/<apikey>/schedules
Returns a list of all schedules.
Parameters
None
Response
HTTP/1.1 200 OK
Etag: 203941fel3ds8ad61903224{
"1": {
"autodelete": false,
"command": {
"address": "/api/8918fbad2100nag17ca1/groups/2/action",
"method": "PUT",
"body": { "on": false }
},
"description": "Turns all lights off",
"etag": "4e100d1c4e3497154a77bc0865c89030",
"name": "turn all off",
"status": "enabled",
"time": "2013-07-30T20:10:00"
},
"2": {
"autodelete": false,
"command": {
"address": "/api/AD4F14F244/groups/4/scenes/1/recall",
"body": {},
"method": "PUT"
},
"description": "",
"etag": "4e100d1c4e3497154a77bc0865c89030",
"name": "call scene",
"status": "enabled",
"time": "W120/T10:00:00"
}
}Response fields
The full schedule object as in Get schedule attributes.
Possible errors
Get schedule attributes
GET /api/<apikey>/schedules/<id>
Returns all attributes of a schedule.
Parameters
None
Response
HTTP/1.1 200 OK
Etag: 0b32030b31ef30a4446c9adff6a6f9e5{
"autodelete": false,
"command": {
"address": "/api/8918fbad2100nag17ca1/groups/2/action",
"method": "PUT",
"body": { "on": false }
},
"description": "Turns all lights off",
"etag": "4e100d1c4e3497154a77bc0865c89030",
"name": "turn all off",
"status": "enabled",
"time": "2013-07-30T20:10:00"
}Response fields
| Field | Type | Description | |
|---|---|---|---|
| autodelete | Bool | If set to true the schedule will be deleted after trigger. Else it will be disabled. | |
| command | Object | The command to execute when the schedule triggers. | |
| command.address | String | The address of a light or group ressource | required |
| command.method | String | must be “PUT” | required |
| command.body | Object | The state that the light or group will activate when the schedule triggers | required |
| description | String | The description of the schedule. | |
| etag | String | The etag of the schedule. | |
| name | String | Name of the schedule. | |
| status | String | The status of the schedule (enabled or disabled). | |
| time | String |
Time when the schedule shall trigger in UTC ISO 8601:2004 format.
|
Possible errors
Set schedule attributes
PUT /api/<apikey>/schedules/<id>
Sets attributes of a schedule.
Parameters
| Field | Type | Description | Required |
|---|---|---|---|
| name | String | The name of the new schedule. If the name already exists a number will be appended. | optional |
| description | String | The description of the schedule. | optional |
| command | Object | The command to execute when the schedule triggers. | optional |
Example request data
{
"name": "working"
}Response
HTTP/1.1 200 OK
Etag: 030cf8c1c0025420f3a0659afab251f5[ { "success": { "/schedules/1/name": "working" } } ]Possible errors
Delete schedule
DELETE /api/<apikey>/schedules/<id>
Deletes a schedule.
Parameters
None
Response
HTTP/1.1 200 OK[ { "success": { "id": "3" } } ]Response fields
| Field | Type | Description |
|---|---|---|
| id | String | The unique identifier of the schedule. |