Skip to content

steipete/eightctl

Repository files navigation

🛏️ eightctl — Control your sleep, from the terminal

A modern Go CLI for Eight Sleep Pods. Control power/temperature, alarms, schedules, audio, base, autopilot, travel, household, and export sleep metrics. Includes a daemon for scheduled routines.

Eight Sleep does not publish a stable public API. eightctl talks to the same undocumented cloud endpoints the mobile apps use. Default OAuth client creds are baked in (from Android APK 7.39.17), so typically you only supply email + password. Status: WIP. The code paths are implemented, but live verification is currently blocked by Eight Sleep API rate limiting on the test account.

Quickstart

# build + install
GO111MODULE=on go install github.com/steipete/eightctl/cmd/eightctl@latest

# create config (optional; flags/env also work)
mkdir -p ~/.config/eightctl
cat > ~/.config/eightctl/config.yaml <<'CFG'
email: "[email protected]"
password: "your-password"
# user_id: "optional"               # auto-resolved via /users/me
# timezone: "America/New_York"      # defaults to local
# client_id / client_secret optional # defaults to app creds
CFG
chmod 600 ~/.config/eightctl/config.yaml

# check pod state
[email protected] EIGHTCTL_PASSWORD=your-password eightctl status

# set temperature level (-100..100)
eightctl temp 20

# run daemon with your YAML schedule (see docs/example-schedule.yaml)
eightctl daemon --dry-run

Command Surface

  • Power & temp: on, off, temp <level>, status
  • Schedules & daemon: schedule list|create|update|delete|next, daemon
  • Alarms: alarm list|create|update|delete|snooze|dismiss|dismiss-all|vibration-test
  • Temperature modes: tempmode nap on|off|extend|status, tempmode hotflash on|off|status, tempmode events
  • Audio: audio tracks|categories|state|play|pause|seek|volume|pair|next, audio favorites list|add|remove
  • Base: base info|angle|presets|preset-run|vibration-test
  • Device: device info|peripherals|owner|warranty|online|priming-tasks|priming-schedule
  • Metrics & insights: sleep day|range, presence, metrics trends|intervals|summary|aggregate|insights
  • Autopilot: autopilot details|history|recap, autopilot set-level-suggestions, autopilot set-snore-mitigation
  • Travel: travel trips|create-trip|delete-trip|plans|create-plan|update-plan|tasks|airport-search|flight-status
  • Household: household summary|schedule|current-set|invitations|devices|users|guests
  • Misc: tracks, feats, whoami, version

Use --output table|json|csv and --fields field1,field2 to shape output. --verbose enables debug logs; --quiet hides the config banner.

Configuration

Priority: flags > env vars (EIGHTCTL_*) > config file.

Key fields: email, password, optional user_id, client_id, client_secret, timezone, output, fields, verbose. The client auto-resolves user_id and device_id after authentication. Config file permissions are checked (warn if >0600).

Tooling

  • Make: make fmt (gofumpt), make lint (golangci-lint), make test (go test ./...)
  • CI: .github/workflows/ci.yml runs format, lint, tests.
  • pnpm scripts (optional): pnpm eightctl|start|build|lint|format|test (see package.json).

Known API realities

  • The API is undocumented and rate-limited; repeated logins can return 429. The client now mimics Android app headers and reuses tokens to reduce throttling, but cooldowns may still apply.
  • HTTPS only; no local/Bluetooth control exposed here.

Prior Work / References

About

Eight Sleep cli to fetch data and control your pods.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published