Schedules

Schedules provide the ability to trigger timed commands to groups or lights.

Create schedule 

POST /api/<apikey>/schedules

Creates a new schedule.

Parameters

FieldTypeDescriptionRequired
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 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.
  • specific date: "yyyy-MM-ddThh:mm:ss"
  • repeated days: "W[0–127]/Thh:mm:ss"
  • timer: "PThh:mm:ss"
  • recurring timer: "R[0–99]/PThh:mm:ss"
Notes:
  • Repeated days use a bitmap to determine on which day of the week the alarm should trigger. The Format is: 0MTWTFSS. Example: 01111100 = 124 is weekdays, 00000011 = 3 is weekend.
  • The number after R of recurring timer determine the number of repetitions of the timer. Not specifying a number means infinity.
  • Randomized times: add Ahh:mm:ss to any time format to add a randomized offset where the value defines the maxium possible offset (max 12 hours). Examaple: W124/T12:30:00A00:30:00 is a 30 min randomized offset.
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

FieldTypeDescription
id String The unique identifier of the new schedule.

Possible errors

400 Bad Request

403 Forbidden


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 attributs.

Possible errors

403 Forbidden


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

FieldTypeDescription
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.
  • specific date: "yyyy-MM-ddThh:mm:ss"
  • repeated days: "W[0–127]/Thh:mm:ss"
  • timer: "PThh:mm:ss"
  • recurring timer: "R[0–99]/PThh:mm:ss"
Notes:
  • Repeated days use a bitmap to determine on which day of the week the alarm should trigger. The Format is: 0MTWTFSS. Example: 01111100 = 124 is weekdays, 00000011 = 3 is weekend.
  • The number after R of recurring timer determine the number of repetitions of the timer. Not specifying a number means infinity.
  • Randomized times: add Ahh:mm:ss to any time format to add a randomized offset where the value defines the maxium possible offset (max 12 hours). Examaple: W124/T12:30:00A00:30:00 is a 30 min randomized offset.

Possible errors

403 Forbidden

404 Not Found


Set schedule attributes  

PUT /api/<apikey>/schedules/<id>

Sets attributes of a schedule.

Parameters

FieldTypeDescriptionRequired
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
command.address String The address of a light or group ressource optional
command.method String Must be "PUT". optional
command.body Object The state that the light or group will activate when the schedule triggers optional
status String 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 time must be in the future.
  • specific date: "yyyy-MM-ddThh:mm:ss"
  • repeated days: "W[0–127]/Thh:mm:ss"
  • timer: "PThh:mm:ss"
  • recurring timer: "R[0–99]/PThh:mm:ss"
Notes:
  • Repeated days use a bitmap to determine on which day of the week the alarm should trigger. The Format is: 0MTWTFSS. Example: 01111100 = 124 is weekdays, 00000011 = 3 is weekend.
  • The number after R of recurring timer determine the number of repetitions of the timer. Not specifying a number means infinity.
  • Randomized times: add Ahh:mm:ss to any time format to add a randomized offset where the value defines the maxium possible offset (max 12 hours). Examaple: W124/T12:30:00A00:30:00 is a 30 min randomized offset.
optional

Example request data

{
    "name": "working"
}

Response


HTTP/1.1 200 OK
Etag: 030cf8c1c0025420f3a0659afab251f5


[ { "success": { "/schedules/1/name": "working" } } ]

Possible errors

400 Bad Request

403 Forbidden

404 Not Found


Delete schedule 

DELETE /api/<apikey>/schedules/<id>

Deletes a schedule.

Parameters

None

Response


HTTP/1.1 200 OK


[ { "success": { "id": "3" } } ]

Response fields

FieldTypeDescription
id String The unique identifier of the schedule.

Possible errors

403 Forbidden

404 Not Found