Skip to content

Fix SoundTouch group Marge compatibility - #360

Open
Mr-Tao wants to merge 1 commit into
deborahgu:mainfrom
Mr-Tao:group-marge-compatibility
Open

Mr-Tao wants to merge 1 commit into
deborahgu:mainfrom
Mr-Tao:group-marge-compatibility

Conversation

@Mr-Tao

@Mr-Tao Mr-Tao commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Title: Fix SoundTouch group Marge compatibility

Summary

This improves the Marge group endpoints used by SoundTouch 10 stereo-pair setup flows.

Rationale

The current group implementation is close, but a real SoundTouch/Stockholm stereo-pair flow expects a few additional response and route shapes:

  • an ungrouped device query should return an empty <group/>, not <groups/>;
  • stored groups should round-trip with a group id;
  • group creation should return a location for the newly created group;
  • speakers and the Stockholm app may use trailing-slash route variants;
  • the Marge API may be asked for an account-level group list.

Without these details, the application can complete parts of the pairing flow but fail to persist or retrieve the group state in the shape expected by the original Bose clients.

Implementation Details

  • Adds GET /marge/streaming/account/{account}/groups.
  • Accepts trailing-slash variants for per-device group lookup and group creation.
  • Returns <group/> for ungrouped devices.
  • Includes the generated group id in serialized group XML.
  • Returns 201 Created and a Location header when creating a group.
  • Accepts PUT as well as POST for updating an existing group.
  • Adds DELETE /marge/streaming/account/{account}/group/ to clear account groups.
  • Normalizes group IDs so datastore callers can pass either a bare id or a Group_<id>.xml filename.
  • Backfills missing role IP addresses from the stored device info.
  • Treats product codes beginning with SoundTouch 10 as groupable.
  • Fixes the existing group service name lookup to use the Group.id value returned by list_groups().

Tests and Validation

  • Added soundcork/tests/test_groups.py covering:
    • datastore group round-tripping with generated ids;
    • <group/> for ungrouped ST10 devices;
    • Marge route shapes used by Stockholm and SoundTouch speakers;
    • group lookup by name in the group service helper.
  • Ran black --target-version py312 --check soundcork/datastore.py soundcork/groups.py soundcork/groups_service.py soundcork/marge.py soundcork/tests/test_groups.py.
  • Ran isort --check-only soundcork/datastore.py soundcork/groups.py soundcork/groups_service.py soundcork/marge.py soundcork/tests/test_groups.py.
  • Ran git diff --check.
  • Ran the full test suite with pytest -q: 33 passed, with one existing Pydantic deprecation warning.
  • Also live-tested this on a UDR-hosted Soundcork instance with two SoundTouch 10 speakers. After both speakers were associated with the same account, creating a stereo pair through the Stockholm UI succeeded.

Compatibility and Risk

This is limited to SoundTouch group metadata handling and Marge group endpoint compatibility. It does not change normal playback, account creation, presets, sources, Spotify handling, or miniapp behavior.

The datastore changes are backwards-compatible with existing Group_<id>.xml files and keep accepting the existing bare-id call style.

Non-Goals

  • This does not add a new end-user group-management UI.
  • This does not implement or change the Stockholm stereo-pair wizard.
  • This does not change speaker-to-speaker zone playback.
  • This does not depend on UniFi-specific deployment behavior.

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