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(client.bed_family_status())
>>> client.set_lights(bedNumber, lightNumber, setting)
>>> pprint(client.get_lights(bedNumber, lightNumber))
>>> client.preset(bedNumber, preset, side, slowSpeed=False)
>>> client.adjust_bed(bedNumber, actuator, position, side, slowSpeed=False)
>>> client.bed_massage(bedNumber, footSpeed, headSpeed, side, timer=0, mode=0)
>>> client.set_sleepnumber(bedNumber, side, sleepnumber)
>>> client.set_favsleepnumber(bedNumber, side, sleepnumber)
>>> pprint(client.get_favsleepnumber(bedNumber))
>>> client.stop_motion(bedNumber, side)
>>> client.stop_pump(bedNumber)
>>> pprint(client.foundation_status(bedNumber))
>>> pprint(client.foundation_system(bedNumber))
>>> pprint(client.foundation_features(bedNumber))

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 and by running the Android app through a proxy. 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

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

  • 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.8

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.8
File Size Uploaded Provenance Actions
sleepyq-0.8.tar.gz 5.0 kB Without provenance Details for sleepyq-0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sleepyq 0.8
File Interpreter ABI Platform Actions
sleepyq-0.8-py3-none-any.whl Python 3 none any Details for sleepyq-0.8-py3-none-any.whl

Total release size: 10.2 kB

Release files / sleepyq-0.8.tar.gz

Download URL sleepyq-0.8.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ce9b02bb3619f0c1ff3209739454ddb5059c536be24f87415c1dac36c9a0cee9
BLAKE2b-256 checksum
How to use checksums
b019863ef56d9aa25232756edfca802c554205f6c994c04fee504d0dcb3de300
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.4.2 requests/2.21.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Release files / sleepyq-0.8-py3-none-any.whl

Download URL sleepyq-0.8-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9cdda8ba512cd3b1bbed7a1829470426f82979e36cadf9144c898c8e4836241
BLAKE2b-256 checksum
How to use checksums
e3aa10af04e7bfbf6a0d9cefe2a08b27f6cf160aece0cf6ad9f2006b5cd0adce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.4.2 requests/2.21.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Security for sleepyq 0.8

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