Skip to main content

SleepIQ API for Python

Project description

Sleepyq is an library for accessing the SleepIQ API from Python. SleepIQ. is an addon for SleepNumber beds.

To install

python3 -m pip install sleepyq

To get started using the library, here’s the full usage:

>>> from sleepyq import Sleepyq
>>> from pprint import pprint
>>>
>>> client = Sleepyq('your-login', 'your-password')
>>> client.login()
>>> pprint(client.sleepers())
>>> pprint(client.beds())
>>> pprint(bed_family_status())

The API is undocumented, so this library does not make much attempt to structure the data from the API into objects.

Development Notes

The SleepIQ API was announced at CES 2016 but there has yet to be any public documentation.

https://sleepiq.sleepnumber.com appears to use the SleepIQ API internally, and methods here were written based on observing use of the site with Chrome Developer Tools. There was also prior art at https://github.com/erichelgeson/sleepiq (the API has changed since then) and https://github.com/natecj/sleepiq-php

The first request to happen is to login. This returns a key (_k) that needs to be used on subsequent requests as a parameter. Subsequent requests also need to be part of the same ‘session’, since those calls expect some cookies to be set.

Todo

  • This is my first python thing, so there are probably plenty of improvements

  • Error check response for non-200 code, or errors returned as JSON

  • Automatically login if necessary, either at first request or when the session expires (if that can be detected)

  • Testing?

  • Explore API more. There are a few more API calls out there, like updating profile, modifying sleep for previous night, but they seem less immediately useful for automation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sleepyq-0.3.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file sleepyq-0.3.tar.gz.

File metadata

  • Download URL: sleepyq-0.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sleepyq-0.3.tar.gz
Algorithm Hash digest
SHA256 dd61604d02aae7520feed31abbd920e2695e6a24fb4518c79f64414a17be80de
MD5 4615c60bc9122aca0027dd78a3b94c4c
BLAKE2b-256 fda1e1c99a54afd1f9298b9480ce22e35d343692a54ab6f2c5a7eb8cb22d098b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page