Schedules

Create Schedule

Scope: Basic

Request URL:

POST /schedules

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
    "controller_id": "G********H3",// serial number of the device
	"days" : "0000010",// days of week you want the schedule to be active
    "active": 1,
    "from_time": 650, //time formula:(H)*60+(min)/10:50 =>10*60= 600 + 60 = 650
    "to_time": 700, //time formula:(H)*60+(min)/11:40 =>11*60= 660 + 40 = 700
    "device_hours": 14, // device hours at the moment of creatio
    "action": "command", //thermostat mode or command
    "target": 24, // target temperature or state// integer//
                     for smartpug or bobbie 0- off, 1 - on
    "push":1 // 1/0 for push notification
    "default_state": "do_nothing"// not working for vicki /"on","off","do_nothing" 
      // when schedule ends, what state you want to set the device, its for melissa bobbie smartplug
}

Response:

{
    "schedules": {
        "controller_id": 1******,
        "days": "0000010",
        "active": 1,
        "from_time": "2021-05-29 10:50:00",
        "to_time": "2021-05-29 11:40:00",
        "action": "command",
        "target": 24,
        "push": 1,
        "user_time_offset": null,
        "id": 21
    },
    "_links": {
        "self": {
            "href": "/v1/schedules"
        }
    }
}

Fetch Controller's Schedule

Scope: Trusted

Request URL:

GET /schedules/{Controller Serial Number}

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Response:

{
    "_embedded": {
        "schedules": [
            {
               ...
            },
            {
                ...
            },
            {
                "controller_id": 1****,
                "from_time": "2021-05-29 10:50:00",
                "to_time": "2021-05-29 11:40:00",
                "days": "0000010",
                "target": 24,
                "main_target": null,
                "default_state": "do_nothing",
                "action": "command",
                "priority": 0,
                "active": 1,
                "push": 1,
                "user_time_offset": null,
                "id": 21,
                "_links": {
                    "self": {
                        "href": "/v1/schedules/21"
                    }
                }
            }
        ]
    },
    "total": 5,
    "_links": {
        "self": {
            "href": "/v1/schedules/GC********3"
        }
    }
}

Fetch Schedule

Scope: Trusted

Request URL:

GET /schedules/{schedule id}    

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Response:

{
    "schedules": {
        "id": 3,
        "controller_id": 2,
        "from_time": "2021-07-02 09:20:00",
        "to_time": "2021-07-02 16:40:00",
        "days": "1111111",
        "target": 27,
        "main_target": null,
        "default_state": "do_nothing",
        "action": "thermostat_mode",
        "priority": 0,
        "active": 1,
        "push": 1,
        "user_time_offset": null
    },
    "_links": {
        "self": {
            "href": "/v1/schedules/3"
        }
    }
}

Update Schedule

Scope: Trusted

Request URL:

PATCH /schedules/{schedules id}

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "from_time" : 1300,
  "to_time" : 1400,
  "days": "0000011"
}

Response:

{
    "schedules": {
        "id": 10,
        "controller_id": 1,
        "from_time": "2021-07-03 21:40:00",
        "to_time": "2021-07-03 23:20:00",
        "days": "0000011",
        "target": 24,
        "main_target": null,
        "default_state": "do_nothing",
        "action": "command",
        "priority": 0,
        "active": 1,
        "push": 1,
        "user_time_offset": null
    },
    "_links": {
        "self": {
            "href": "/v1/schedules/10"
        }
    }
}

Delete Schedule

Scope: Trusted

Request URL:

Delete /schedules/{schedules id}

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Response:

{
    "schedules": {
        "id": 57
    },
    "_links": {
        "self": {
            "href": "/v1/schedules/57"
        }
    }
}

Last updated