Skip to content

feat(sonos): add experimental local playback targets - #391

Draft
mrzhbr wants to merge 6 commits into
LargeModGames:mainfrom
mrzhbr:feat/sonos-current
Draft

feat(sonos): add experimental local playback targets#391
mrzhbr wants to merge 6 commits into
LargeModGames:mainfrom
mrzhbr:feat/sonos-current

Conversation

@mrzhbr

@mrzhbr mrzhbr commented Jul 19, 2026

Copy link
Copy Markdown

Summary

  • discover Sonos S1/S2 rooms over local SSDP/UPnP and expose them alongside Spotify Connect devices
  • persist room selection as sonos:<UUID> and route local transport, seek, volume, metadata, CLI, and playbar behavior through a dedicated Sonos backend
  • resolve grouped-room transport and queue operations through the group coordinator while keeping room volume local
  • replace stale Sonos queues for new playback, preserve playlist context offsets, and start explicit URI lists immediately while continuation tracks preload asynchronously with cancellation and serialized queue mutations
  • pause Sonos explicitly when native, decoded, CLI-selected, or other Spotify playback takes ownership
  • validate LAN endpoints, disable redirects, bound response sizes, and provide credential-free SOAP diagnostics

Hardware validation

Validated on standalone S1 and S2 rooms, including multiple-room selection:

  • playlist playback and continuation
  • Liked Songs playback and continuation
  • next/previous, seek, pause/play, and volume
  • queue replacement and queue-add behavior
  • Sonos-to-native playback handoff
  • restart and persisted-room behavior

Grouped-room coordinator behavior is covered by mock integration tests but could not be hardware-tested. Sonos queue viewing and Sonos shuffle/repeat remain intentionally unsupported.

Verification

  • cargo fmt --all --check
  • cargo clippy --no-default-features --features telemetry -- -D warnings
  • cargo test --no-default-features --features telemetry — 519 passed
  • cargo clippy -- -D warnings
  • cargo test — 738 passed
  • cargo clippy --features all-sources -- -D warnings
  • LSP diagnostics: clean

Related to #251.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d406a762-42e8-4c6b-b243-1c47c0dfd05a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands.

@mylesagray

Copy link
Copy Markdown

@mrzhbr Do you have any logging to enable debugging?

I have a firewalled network, and tested this out with logging on my router - i'm not seeing the SSDP discovery packet from Spotatui.

I can use the Sonos S2 app and it is receiving SSDP messages on the same laptop, at the same time that spotatui isn't finding the players, however is uses both 255.255.255.255:1900 as well as the 239.255.255.250:1900 that you have configured.

When looking at tcpdump while hitting d to enter devices view:

14:09:12.426613 IP (tos 0x0, ttl 1, id 3922, offset 0, flags [none], proto UDP (17), length 129)
    172.16.200.189.55473 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 101
E....R....ER...........l.m.+M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 1
ST: upnp:rootdevice


14:09:12.426902 IP (tos 0x0, ttl 1, id 11026, offset 0, flags [none], proto UDP (17), length 122)
    172.16.200.189.55473 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 94
E..z+.....)............l.fn.M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 1
ST: ssdp:all

I get some responses like this after a few seconds:

14:10:35.127591 IP (tos 0x0, ttl 1, id 0, offset 0, flags [DF], proto UDP (17), length 798)
    172.16.250.96.45479 > 239.255.255.250.ssdp: [udp sum ok] UDP, length 770
E.....@....c...`.......l.
:.NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age = 3600
LOCATION: http://172.16.250.96:1400/xml/group_description.xml
NT: urn:smartspeaker-audio:service:SpeakerGroup:1
NTS: ssdp:alive
SERVER: Linux UPnP/1.0 Sonos/86.8-78270 (ZPS1)
USN: uuid:RINCON_5CAAFD2D43F601400::urn:smartspeaker-audio:service:SpeakerGroup:1
BOOTID.UPNP.ORG: 294
CONFIGID.UPNP.ORG: 1
GROUPINFO.SMARTSPEAKER.AUDIO: gc=1; gid=RINCON_5CAAFD2D43F601400:812652129; gname="Room"
WEBSOCK.SMARTSPEAKER.AUDIO: wss://172.16.250.96:1443/websocket/api
HOUSEHOLD.SMARTSPEAKER.AUDIO: Sonos_xDv1a7V0KQzLDtkTi5BvST81Pa.7YOCuu7wBOMMHqeoeJbF
LOCATION.SMARTSPEAKER.AUDIO: lc_0c656699647543709c18b7c646eb989a
APIVER.SMARTSPEAKER.AUDIO: 1.53.1
MINAPIVER.SMARTSPEAKER.AUDIO: 1.1.0

Which seems to match your code for device filtering:

https://github.com/LargeModGames/spotatui/pull/391/changes#diff-71d6aca72d30690c4067a4117b3dcfcfcb35790b6f096c196fdb8067cbe48e88R152-R157

However nothing is showing up in the devices pane.

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.

2 participants