Skip to content

Add adjustable base (elevation) control tools#1

Open
MaxGhenis wants to merge 1 commit intoelizabethtrykin:masterfrom
MaxGhenis:add-base-control
Open

Add adjustable base (elevation) control tools#1
MaxGhenis wants to merge 1 commit intoelizabethtrykin:masterfrom
MaxGhenis:add-base-control

Conversation

@MaxGhenis
Copy link
Copy Markdown

Summary

  • Add three new MCP tools for controlling the Eight Sleep adjustable base (elevation)
  • Add credential fallback from ~/.config/eightctl/config.yaml
  • Auto-discover userId and deviceId when not configured

New tools

Tool Description
getBaseStatus Get current torso/leg angles, moving status, and snore mitigation status
setBaseAngle Set torso (0-60) and leg (0-45) elevation angles
setBasePreset Set a named preset: sleep, relaxing, or reading

Implementation notes

The base control endpoints use app-api.8slp.net rather than client-api.8slp.net. A separate axios client (appClient) is created with the same auth interceptors but pointed at the app API. This was confirmed by testing against a live Pod 5 with an adjustable base.

The endpoint signatures match the Home Assistant Eight Sleep integration:

GET  /v1/users/{userId}/base
POST /v1/users/{userId}/base/angle?ignoreDeviceErrors=false

Test plan

  • Builds cleanly with tsc
  • Tested getBaseStatus against live Pod 5 - returns correct angles
  • Tested setBaseAngle against live Pod 5 - bed physically moves to target angle
  • Tested setBasePreset against live Pod 5 - bed moves to preset position
  • Existing tools unaffected (same client-api host, no breaking changes)

🤖 Generated with Claude Code

Add three new MCP tools for controlling the Eight Sleep adjustable base:
- getBaseStatus: get current torso/leg angles, moving status, snore mitigation
- setBaseAngle: set torso (0-60°) and leg (0-45°) elevation
- setBasePreset: set named presets (sleep, relaxing, reading)

Key implementation details:
- Base endpoints use app-api.8slp.net (not client-api.8slp.net)
- Separate axios client with shared auth interceptors for the app API
- Auto-discover userId from auth response when not configured
- Auto-discover deviceId from user profile when not configured
- Credential fallback: reads ~/.config/eightctl/config.yaml if env vars not set
- Default OAuth client credentials (same public app credentials used by all clients)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant