Skip to main content

Overview

Get the current thermostat schedule or update it with a new schedule configuration.

Endpoints

GET https://nolongerevil.com/api/v1/thermostat/{deviceId}/schedule
PUT https://nolongerevil.com/api/v1/thermostat/{deviceId}/schedule

Authentication

Required Scopes:
  • read for GET
  • write for PUT

Get Schedule

Request

GET /api/v1/thermostat/{deviceId}/schedule
Authorization: Bearer nle_your_api_key_here

Response (200 OK)

{
  "device": {
    "id": "dev_abc123xyz",
    "serial": "02AA01AB01234567",
    "name": "Living Room"
  },
  "schedule": {
    "ver": 2,
    "days": {
      "0": {
        "0": {
          "temp": 24.83397,
          "time": 0,
          "type": "COOL",
          "entry_type": "continuation"
        },
        "1": {
          "temp": 22.0,
          "time": 61200,
          "type": "COOL",
          "entry_type": "setpoint"
        }
      },
      "1": { ... },
      ...
    },
    "name": "Current Schedule",
    "schedule_mode": "COOL"
  }
}

Response if No Schedule

{
  "device": { ... },
  "schedule": null
}

Update Schedule

Request

PUT /api/v1/thermostat/{deviceId}/schedule
Authorization: Bearer nle_your_api_key_here
Content-Type: application/json

Request Body

FieldTypeRequiredDescription
scheduleobjectYesComplete schedule object
{
  "schedule": {
    "ver": 2,
    "days": { ... },
    "name": "Weekly Schedule",
    "schedule_mode": "HEAT"
  }
}

Schedule Structure

Days Object

Keys are day of week (0 = Sunday, 6 = Saturday):
{
  "0": { ... }, // Sunday
  "1": { ... }, // Monday
  "2": { ... }, // Tuesday
  ...
  "6": { ... }  // Saturday
}

Schedule Entry

Each day contains numbered entries (0, 1, 2, …):
FieldTypeDescription
tempnumberTemperature in Celsius
timenumberSeconds since midnight (0-86400)
typestring"HEAT", "COOL", or "RANGE"
entry_typestring"setpoint" or "continuation"
Example: 6:00 AM = 21600 seconds (6 × 60 × 60)

Code Examples

curl https://nolongerevil.com/api/v1/thermostat/dev_abc123xyz/schedule \
  -H "Authorization: Bearer nle_your_api_key_here"

Use Cases

Simple Weekly Schedule

const weekdaySchedule = {
  ver: 2,
  name: "Weekday Schedule",
  schedule_mode: "HEAT",
  days: {
    1: { // Monday
      0: { temp: 18, time: 0, type: "HEAT", entry_type: "continuation" },
      1: { temp: 21, time: 21600, type: "HEAT", entry_type: "setpoint" }, // 6 AM
      2: { temp: 18, time: 32400, type: "HEAT", entry_type: "setpoint" }, // 9 AM
      3: { temp: 22, time: 61200, type: "HEAT", entry_type: "setpoint" }  // 5 PM
    },
    // Repeat for Tuesday-Friday (2-5)
    ...
  }
};

await updateSchedule(deviceId, weekdaySchedule);

Copy Schedule

// Copy schedule from one device to another
const { schedule } = await getSchedule(sourceDeviceId);
await updateSchedule(targetDeviceId, schedule);
Schedules are complex objects. It’s recommended to get the existing schedule, modify it, and update it rather than creating from scratch.

Next Steps