Skip to main content

Wrapper around the (undocumented) SNOO Smart Bassinet API

Project description

SNOO

This is an API client to the SNOO Smart Bassinet. The SNOO is a bassinet that will rock your baby to sleep, and responds to the baby by trying to sooth it with different rocking motions and sounds when it detects crying.

Currently, it supports getting the current session data from SNOO, and historic data. It does not allow you to control the SNOO (the control API is provided by PubNub and is different from the read-only data API hosted by happiestbaby.com)

A word of caution

The SNOO API is undocumented. Using it might or might not violate Happiest Baby, Inc Terms of Service. Use at your own risk.

Usage

Installation

pip install snoo

Command line usage

To get the status of your snoo, simply run

$ snoo status
Soothing 26m

The first time you run it, it will prompt for your username and password. These will be stored in either ~/.snoo_config or ~/.config/snoo/snoo.config, depending on your system. The output of the snoo command is the status (Awake, Asleep, or Soothing), and the duration of the current session.

Exporting data

To export data of each individual session, use

$ snoo sessions --start DATE --end DATE

where DATE follows the format 2019-12-03. By default, --start and --end correspond to yesterday and today, respectively.

The result is a CSV formatted list of sessions in the snoo, eg.

start_time,end_time,duration,asleep,soothing
2019-12-03T12:35:11,2019-12-03T13:59:04,5033,4218,815
2019-12-03T15:28:13,2019-12-03T15:28:41,28,17,11
...

where duration, asleep, and soothing are durations given in seconds.

Alternatively, you can get aggregated information about each day using snoo days:

date,naps,longestSleep,totalSleep,daySleep,nightSleep,nightWakings,timezone
2019-12-03,6,12933,58035,25038,32997,4,None

Again, all durations are given in seconds. How daySleep and nightSleep are defined is set in your Snoo app.

Programmatic usage

from snoo import Client

client = Client()
# Find out where your config is stored
print(client.config_path)
# Get data from your current session
current_session = client.get_current_session()
# Print the status of the current session.
print(client.status())

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

snoo-0.3.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snoo-0.3.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file snoo-0.3.0.tar.gz.

File metadata

  • Download URL: snoo-0.3.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0b4 CPython/3.7.4 Darwin/19.0.0

File hashes

Hashes for snoo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b6a99cfe46b1367731a6cd4ca9c180692e1c110617abf3ef0cd046c8bf328b13
MD5 1c0dae689e3fb879040e5a1c4fd5e75d
BLAKE2b-256 700c2da2a1581a042bc2f2da586e8c81f08ffecd58b9588385ad1f4fca542677

See more details on using hashes here.

File details

Details for the file snoo-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: snoo-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0b4 CPython/3.7.4 Darwin/19.0.0

File hashes

Hashes for snoo-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 620c2fbbf545c0e9971d18fdbc44cbbad0163025c6538b91f2d7a916a7ebaab6
MD5 c9ee31051ec4aaac9d569fe79b57190a
BLAKE2b-256 34435c7376fb5d026e263c8b1cc47e04d5332267d001cca00facf8c52d15af5b

See more details on using hashes here.

Supported by

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