Skip to main content

Sleepyq

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.

Metadata

Release files for sleepyq 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sleepyq 0.6
File Size Uploaded Provenance Actions
sleepyq-0.6.tar.gz 2.9 kB Without provenance Details for sleepyq-0.6.tar.gz

Release files / sleepyq-0.6.tar.gz

Download URL sleepyq-0.6.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cd988c95c76b0b48647ccd068de86299e840083f702428386e5fd64b9d0d8701
BLAKE2b-256 checksum
How to use checksums
65b0d61fe8f76f6ee7c20c06322878234adacf8085c20d0ab4b0f75e0386ac91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for sleepyq 0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page