An API client to the SNOO Smart Sleeper Bassinet. The SNOO is a bassinet that will rock your baby to sleep. It responds to baby by trying to sooth it with different rocking motions and sounds when it detects crying.
The client only supports getting session and daily aggregated data from the SNOO. It does not allow you to control the SNOO. That API is provided by PubNub and is different from the read-only data API hosted by Happiest Baby.
The SNOO API is undocumented. Using it might or might not violate Happiest Baby, Inc's Terms of Service. Use at your own risk.
You can grab the latest version with curl
. For Linux:
sudo curl -o /usr/local/bin/snoo https://github.com/ksindi/snoo/releases/download/v0.1.0/snoo-linux
sudo chmod +x /usr/local/bin/snoo
Or on MacOS:
sudo curl -o /usr/local/bin/snoo https://github.com/ksindi/snoo/releases/download/v0.1.0/snoo-darwin
sudo chmod +x /usr/local/bin/snoo
$ snoo -h
NAME:
snoo - An API client to the SNOO Smart Sleeper Bassinet
USAGE:
snoo [global options] command [command options] [arguments...]
VERSION:
0.1.0
COMMANDS:
sessions print list of sessions for a date range
days print list of daily aggregated sessions for a date range
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--username value SNOO login username [$SNOO_USERNAME]
--password value SNOO login password [$SNOO_PASSWORD]
--debug Enable verbose debugging (default: false)
--help, -h show help (default: false)
--version, -v print the version (default: false)
To export daily aggregated data, use
$ snoo days --start DATE --end DATE
date,naps,longest_sleep,total_sleep,day_sleep,night_sleep,night_wakings,timezone
2020-08-01 00:00:00 +0000 UTC,4,12997,55829,33950,21879,3,
All durations are given in seconds. How day_sleep
and night_sleep
are defined is set in your Snoo app.
To export sessions, use
$ snoo sessions --start DATE --end DATE
session_id,start_time,end_time,duration,asleep_duration,soothing_duration
1425693702,2020-08-22 00:00:00,2020-08-22 03:09:10,11350,11350,0
1609190237,2020-08-22 03:35:16,2020-08-22 08:20:54,17138,17138,0
1919690037,2020-08-22 10:12:26,2020-08-22 11:31:37,4751,3357,1394
Again, all durations are given in seconds. How asleep_duration
and soothing_duration
are defined is set in your Snoo app.
package main
import (
"context"
"log"
"net/http"
"github.com/ksindi/snoo"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
client := snoo.NewClient("my_username", "my_password")
// declare an empty interface
var result map[string]interface{}
err := client.MakeRequest(ctx, http.MethodGet, "/ss/v2/sessions/last", nil, nil, &result)
if err != nil {
log.Fatalln(err)
}
}
This repo is inspired by https://github.com/maebert/snoo.