feat(cmd): add away mode (vacation) command#26
Open
omarshahine wants to merge 1 commit intosteipete:mainfrom
Open
feat(cmd): add away mode (vacation) command#26omarshahine wants to merge 1 commit intosteipete:mainfrom
omarshahine wants to merge 1 commit intosteipete:mainfrom
Conversation
Add `eightctl away on` and `eightctl away off` to activate/deactivate away mode. When away, the pod stops heating/cooling. Supports per-side and whole-pod control: - Default: authenticated user's side only - --both: both sides of the pod - --user-id: specific user/side Changes: - Add appAPIBaseURL constant (app-api.8slp.net, used by away mode) - Refactor do() into do() + doURL() to support requests to different base URLs - Add Device().Sides() to fetch left/right user ID assignments - Add Client.SetAwayMode(ctx, userID, away) method - Add away command with on/off subcommands and --both flag API details reverse-engineered from the Eight Sleep Home Assistant integration (pyEight): - PUT https://app-api.8slp.net/v1/users/{userId}/away-mode - Payload: {"awayPeriod": {"start"|"end": "<ISO 8601 timestamp>"}} - Timestamps set 24h in the past to trigger immediately Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eightctl away onandeightctl away offcommands--bothflag to toggle both sides of the pod at oncedo()intodo()+doURL()to support the separate app API hostDetails
Away mode tells the pod to stop heating/cooling for a given side — useful when traveling. The API lives on
app-api.8slp.net(separate fromclient-api.8slp.net), which required addingdoURL()for absolute-URL requests.API contract (reverse-engineered from Eight Sleep Home Assistant integration):
Timestamps are set 24h in the past to trigger immediately (same pattern as pyEight and the official app).
Usage
Changes
internal/client/eightsleep.goappAPIBaseURL, refactordo()→doURL(), addSetAwayMode()internal/client/device.goDeviceSidestype andSides()methodinternal/cmd/away.goawaycommand withon/offsubcommands and--bothflaginternal/cmd/root.goawayCmdTest plan
eightctl away on --quietactivates away for authenticated usereightctl away off --quietdeactivates awayeightctl away on --both --quietactivates both sideseightctl away --helpshows subcommands and--bothflaggo test ./...)🤖 Generated with Claude Code