Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [Unreleased]

### Fixed
- Preserve saved scenes on failed volume/mute reads and report grouping or audio-setting failures when applying scenes. Thanks @SebTardif.
- Report missing queue positions after enqueueing without starting unrelated playback; explain how to recover without enqueueing twice. Thanks @SebTardif.
- Honor explicit speaker IPs when saving and applying scenes.

### Changed
- Use Go 1.27.4 for build, CI, Docker and release tooling while retaining Go 1.26 compatibility; update pflag to 1.1.0.

## [0.3.5] - 2026-10-23

**Highlights:** Fix the reachable crypto/x509 vulnerability GO-2026-6809 with Go 1.27.3, explain SMAPI API-client identity rejections, and correctly label initial watch events.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.27.0

ARG GO_VERSION=1.27.3
ARG GO_VERSION=1.27.4

FROM golang:${GO_VERSION}-bookworm AS build
WORKDIR /src
Expand Down
4 changes: 3 additions & 1 deletion docs/commands/sonos-scene.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sonos scene apply evening --only "Kitchen" # experimental
| --- | --- |
| `--only string` | Restore only the saved state for one room (experimental). |

Apply is best-effort and idempotent — if a member is offline, that step is skipped and the rest of the scene is still applied.
Apply is idempotent. Speakers absent from the current topology are skipped; a failed command to a visible speaker stops the operation with an error. Completed changes are not rolled back.

## `sonos scene delete`

Expand All @@ -52,3 +52,5 @@ sonos scene delete evening
## See also

- [Scenes](../scenes.md) — what's captured, what isn't, and how apply works under the hood.

Save preserves the existing file when a volume or mute read fails. Save and apply accept `--ip <speaker-ip>` to bypass discovery for the topology query.
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ go install github.com/steipete/sonoscli/cmd/sonos@latest
sonos --version
```

Source builds retain Go 1.26 as the minimum and prefer Go 1.27.3 via `go.mod`. CI and Docker builds use the same preferred patch version.
Source builds retain Go 1.26 as the minimum and prefer Go 1.27.4 via `go.mod`. CI and Docker builds use the same preferred patch version.

The binary lands in `$(go env GOBIN)` (defaults to `$HOME/go/bin`) — make sure that's on your `PATH`.

Expand Down
8 changes: 5 additions & 3 deletions docs/scenes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sonos scene apply evening
sonos scene delete evening
```

Apply is best-effort and idempotent — running `sonos scene apply evening` twice is safe.
Apply is idempotent. It stops and reports any speaker command failure; already completed changes are not rolled back.

## Targeting one room (experimental)

Expand Down Expand Up @@ -62,14 +62,16 @@ sonos open --name "Living Room" spotify:playlist:37i9dQZF1DXcBWIGoYBM5M
4. Re-create the saved groups (each member joins the saved coordinator).
5. Re-apply per-room volume and mute.

If a speaker named in the scene has gone offline, the corresponding step is logged and skipped — the rest of the scene still applies.
Speakers absent from the current topology are skipped. A command failure on a visible speaker stops the apply operation and returns an error.

## File layout

Scenes live alongside your config:

```
~/.config/sonoscli/scenes/<name>.json
<user-config-dir>/sonoscli/scenes.json
```

The format is intentionally readable and stable; you can hand-edit a scene file if you really want to.

Saving a scene fails without replacing the saved file if any volume or mute read fails. Use `--ip <speaker-ip>` with save or apply to read topology directly from that speaker, bypassing discovery.
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Expected:
- All commands exit `0`
- CI should match `.github/workflows/ci.yml` (`gofmt`, coverage, `golangci-lint`, race tests, `go vet`)
- CI enforces a minimum total coverage of `75%` (statement coverage across `./...`) and a focused `85%` floor for the stream proxy package.
- The main CI job uses the preferred Go 1.27.3 toolchain from `go.mod`; a separate job tests the Go 1.26.0 source minimum with automatic toolchain switching disabled. Docker and release builds use the same patched toolchain.
- The main CI job uses the preferred Go 1.27.4 toolchain from `go.mod`; a separate job tests the Go 1.26.0 source minimum with automatic toolchain switching disabled. Docker and release builds use the same patched toolchain.
- To verify release builds without publishing or creating tags, dispatch `release-unified.yml` on `main` with the current version and `dry_run: true`.

## Live network test plan (manual)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module github.com/steipete/sonoscli

go 1.26

toolchain go1.27.3
toolchain go1.27.4

require github.com/spf13/cobra v1.10.2

require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/pflag v1.1.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.1.0 h1:6W6MbVUrnMb8PEhjkqwsVLY7ryuzRfFHF4mQd7L94ag=
github.com/spf13/pflag v1.1.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
33 changes: 26 additions & 7 deletions internal/cli/scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ var newSceneSpeakerClient = func(ip string, timeout time.Duration) sceneSpeakerC
return sonos.NewClient(ip, timeout)
}

func sceneTopologyClient(ctx context.Context, flags *rootFlags) (sceneTopologyGetter, error) {
if strings.TrimSpace(flags.IP) != "" {
return sonos.NewClient(strings.TrimSpace(flags.IP), flags.Timeout), nil
}
return newSceneTopologyGetter(ctx, flags.Timeout)
}

func newSceneCmd(flags *rootFlags) *cobra.Command {
cmd := &cobra.Command{
Use: "scene",
Expand Down Expand Up @@ -116,7 +123,7 @@ func newSceneSaveCmd(flags *rootFlags) *cobra.Command {
if err != nil {
return err
}
tg, err := newSceneTopologyGetter(cmd.Context(), flags.Timeout)
tg, err := sceneTopologyClient(cmd.Context(), flags)
if err != nil {
return err
}
Expand Down Expand Up @@ -165,8 +172,14 @@ func newSceneSaveCmd(flags *rootFlags) *cobra.Command {
}
seen[m.UUID] = true
c := newSceneSpeakerClient(m.IP, flags.Timeout)
vol, _ := c.GetVolume(cmd.Context())
mute, _ := c.GetMute(cmd.Context())
vol, err := c.GetVolume(cmd.Context())
if err != nil {
return fmt.Errorf("get volume for %s: %w", m.Name, err)
}
mute, err := c.GetMute(cmd.Context())
if err != nil {
return fmt.Errorf("get mute for %s: %w", m.Name, err)
}
scene.Devices = append(scene.Devices, scenes.SceneDevice{
UUID: m.UUID,
Name: m.Name,
Expand Down Expand Up @@ -213,7 +226,7 @@ func newSceneApplyCmd(flags *rootFlags) *cobra.Command {
return errors.New("scene not found: " + name)
}

tg, err := newSceneTopologyGetter(cmd.Context(), flags.Timeout)
tg, err := sceneTopologyClient(cmd.Context(), flags)
if err != nil {
return err
}
Expand Down Expand Up @@ -285,7 +298,9 @@ func newSceneApplyCmd(flags *rootFlags) *cobra.Command {
if ip == "" {
continue
}
_ = newSceneSpeakerClient(ip, flags.Timeout).LeaveGroup(cmd.Context())
if err := newSceneSpeakerClient(ip, flags.Timeout).LeaveGroup(cmd.Context()); err != nil {
return fmt.Errorf("leave group for %s: %w", dev.Name, err)
}
}

// Step 2: rebuild groups.
Expand Down Expand Up @@ -342,8 +357,12 @@ func newSceneApplyCmd(flags *rootFlags) *cobra.Command {
continue
}
c := newSceneSpeakerClient(ip, flags.Timeout)
_ = c.SetMute(cmd.Context(), dev.Mute)
_ = c.SetVolume(cmd.Context(), dev.Volume)
if err := c.SetMute(cmd.Context(), dev.Mute); err != nil {
return fmt.Errorf("set mute for %s: %w", dev.Name, err)
}
if err := c.SetVolume(cmd.Context(), dev.Volume); err != nil {
return fmt.Errorf("set volume for %s: %w", dev.Name, err)
}
}

return writeOK(cmd, flags, "scene.apply", map[string]any{"name": scene.Name, "only": strings.TrimSpace(only)})
Expand Down
Loading
Loading