Schedules
Read and change the weekly sleep schedule, or change a single night.
A sleep schedule tells the device what to do each night: when to start, which temperatures to hold, and when to wake you. Each person has their own schedule, for their own zone.
Days, nights and times
- Days of the week are named
sunday,monday…saturday. - A night is named by its sleep day: the date the night starts, in the device's time zone, as
YYYY-MM-DD. The night from Friday evening into Saturday morning is Friday's sleep day. - Times of day are 24-hour
HH:MMstrings, such as"22:30", in the device's time zone. - Temperatures are in °C, in
temp_c.
The four phases
A night has four phases, in time order, named as the Orion app shows them:
alarm_enabled turns the alarm phase on or off. On, the device wakes you at the alarm time and turns itself off after it. Off, the device keeps running past the alarm time.
night and dawn keep their distance from bedtime or the alarm (usually night from bedtime and dawn from the alarm). If you move bedtime or the alarm, they move too, unless you also send their own time.
Read the schedule
Get sleep schedules returns schedules keyed by user id: yours, and those of everyone you may view on shared devices. Pass user_id for one person, and days (1 to 30, default 1) for how many nights from tonight to include.
weekis the recurring schedule, one entry per day.nightsis tonight and the next nights as the device will actually run them, with one-night changes and Orion Intelligence changes applied. Where Orion Intelligence changed a night,changessays what and why.todayis the current sleep day.
Read the schedule before you change it.
Change the weekly schedule
Update sleep schedules changes the recurring schedule. Send only the days and fields that change; days you leave out stay as they are. Each phase you send names its phase and the time or temp_c to change.
Set the bedtime temperature to 18 °C on weeknights and move Saturday's alarm:
"enabled": false turns a day's schedule off. "remove": true on a night or dawn phase removes that phase; send nothing else with it.
The answer is the person's schedule after the change, in the same shape as the read.
Change one night
Change one night changes one night without touching the weekly schedule. That night keeps these values; the other nights follow the week. It changes tonight unless you pass a later sleep_day.
Skip tonight:
Wake up later on a given night:
Send at least one of enabled, alarm_enabled or phases.
Undo a one-night change
Revert one night takes away a night's own values, so it follows the weekly schedule again. It reverts tonight unless you pass sleep_day. Reverting a night with no changes does nothing.
Someone else's schedule
Every schedule operation takes an optional user_id. Leave it out for your own schedule. To view or change another person's, pass their id from shared_with in List devices. You need the owner or admin role on a device you share with them; guests can only view and change their own. Otherwise the answer is 403 forbidden.
When the schedule changes under you
Orion Intelligence and the Orion app can change a schedule while your request is on its way. The API checks that your change is built on the latest schedule and tries again if it is not. If the write still fails, read the schedule again and resend your change. See Errors for retry advice.