core icon indicating copy to clipboard operation
core copied to clipboard

TV Audio gets interrupted when Spotify switches to the next track

Open lars909 opened this issue 3 weeks ago • 21 comments

Description

Since the latest beta (possibly earlier, but I only noticed it recently), I've been experiencing an issue when switching from Spotify playback to TV Audio.

When I'm listening to Spotify and then turn on my TV, Sonos correctly detects TV Audio and automatically switches to it. So far, everything works as expected.

However, as soon as Spotify moves to the next track, Sonos automatically switches back from TV Audio to Spotify playback.

This is quite annoying because I have to manually select TV Audio again. To prevent this from happening repeatedly, I also have to open the Loxone app and manually stop Spotify playback.

Steps to Reproduce

  1. Start playing music via Spotify using Sonos Audio.
  2. Turn on the TV so that Sonos automatically switches to TV Audio.
  3. Wait until Spotify advances to the next track.
  4. Sonos switches back to Spotify, interrupting TV Audio.

Expected Behavior

Once TV Audio has been activated, it should remain the active source until I manually switch to another source.

Spotify track changes should not override TV Audio.

Actual Behavior

Every time Spotify advances to the next track, Sonos switches back to Spotify playback, even though TV Audio was already active.

Additional Information

I'm currently using the latest beta. I'm not sure whether this issue was introduced in this version or was already present before.

lars909 avatar Nov 08 '26 16:11 lars909

Thanks for the clear steps. Fixed on dev, in the next beta: when the Sonos switches to another source by itself (TV audio, for example) while it was playing sonn's stream, sonn now lets go of the zone. Spotify is paused, so the next track isn't sent to the speaker, and no stop is sent, so the TV keeps playing. It stays that way until you pick something again in Loxone or Spotify. I couldn't test it on a real soundbar, so please let me know whether it behaves this way for you.

rudyberends avatar Nov 11 '26 16:11 rudyberends

Thanks for the fix! That sounds exactly like the expected behavior.

Unfortunately, I can't properly test it yet because Sonos grouping seems to be broken in the latest dev build.

The master/client assignment behaves strangely. The speaker that was previously always the client suddenly becomes the master, and creating new groups through Loxone no longer works at all.

Even if I manually ungroup both speakers in the Sonos app first, I'm still unable to create a new group through Loxone.

It seems like something more fundamental is broken with the grouping functionality in the current dev build.

Once grouping works again, I'll be happy to test the TV Audio fix and provide feedback!

lars909 avatar Nov 13 '26 13:11 lars909

Thanks for letting me know. That's probably caused by something else that changed in the same dev build, so I'd like to look at it first.

Could you set the log level to debug, try to create the group from Loxone once, and attach the log? Please also tell me which speaker should be the master.

And do you have an "Audio Player Group fixed" in Loxone Config with these two players in it? That's my main suspect right now.

rudyberends avatar Nov 14 '26 09:11 rudyberends

Yes, exactly. It affects the two speakers configured in the fixed group (Wohnbereich and Gäste-WC).

When I manually ungroup them in the Sonos app and then try to create a new group in Loxone, nothing happens when I click "Create Group".

There are a few things I've noticed:

  • In Sonn, Gäste-WC is shown as the master and Wohnbereich as the client, although it has always been the other way around.
  • Creating a group through Loxone no longer works, even after manually ungrouping both speakers in the Sonos app.
  • Starting music playback also no longer works correctly in the current dev build.
  • All of this still works perfectly fine in the current beta. The problems only appear in the latest dev build.

I checked the debug log and noticed something interesting.

During startup, Sonn creates the fixed group with zone 3 (Gäste-WC) as the leader, although zone 2 (Wohnbereich) should normally be the master:

14:39:46.468 Loxone|ConfigService
[groups=[{"id":"2149054e-021a-326f-ffff60373d362013","players":[3,2]}]] applying fixed groups

14:39:46.538 Groups|Manager
[externalId=2149054e-021a-326f-ffff60373d362013 leader=3] group created

When I then try to create a group in Loxone, the following error appears repeatedly:

14:41:14.704 Groups|Handlers
[fixedGroup=2149054e-021a-326f-ffff60373d362013 groupIdRaw=new leader=2] dgroup update refused: fixed group

14:41:15.891 Groups|Handlers
[fixedGroup=2149054e-021a-326f-ffff60373d362013 groupIdRaw=new leader=2] dgroup update refused: fixed group

14:41:16.067 Groups|Handlers
[fixedGroup=2149054e-021a-326f-ffff60373d362013 groupIdRaw=new leader=2] dgroup update refused: fixed group

It looks like Sonn is refusing the group creation request because the speakers are already assigned to a fixed group, even though they are no longer physically grouped in Sonos.

Maybe this also explains why the master/client assignment is reversed?

For reference, I'm running:

4.0.0-beta.23+dev-20261114105020

Unfortunately, this prevents me from testing the TV Audio fix properly. I'll be happy to test it again once grouping works as expected.

Thanks for looking into it!

lars909 avatar Nov 14 '26 14:11 lars909

Thanks, the log made it clear: the fixed group was the problem. sonn made the first player in the Miniserver's list the leader (Gäste-WC for you) and refused every group you created in Loxone that included those players.

Loxone doesn't actually give a fixed group a master: the players always play the same source, whichever one you start it on. That's how it works in sonn now:

  • Whatever player you start something on leads the group, and the other player follows.
  • Grouping from Loxone works again. If you group exactly those two players, the one you pick as master leads. If you add other players, the whole fixed group comes along, and once you dissolve that group the fixed group is back.

It's in the dev build that's building now. Could you test grouping first, and then the TV audio fix?

rudyberends avatar Nov 15 '26 10:11 rudyberends

Thanks for the quick fix! I've tested the latest dev build.

Good news: Grouping and music playback are working again, just like in beta.23. The fixed group behaves as expected now. 👍

Unfortunately, the original TV Audio issue is still not resolved.

Here's what happens:

  1. I start Spotify playback on my fixed group (Wohnbereich + Gäste-WC).
  2. I switch to TV Audio.
  3. Sonos correctly switches to TV Audio, and Spotify music stops playing on the entire fixed group. So far, everything works as expected.
  4. However, I can already see in the Loxone app that Spotify playback apparently continues in the background (see attached screenshot).
  5. As soon as Spotify advances to the next track, Sonn switches the speakers back to Spotify, interrupting TV Audio again.

I also checked the debug logs, and they seem to confirm this behavior.

At 10:45:14, Spotify is still playing on zone 2 (Wohnbereich):

10:45:14.997 Audio|SoloistProcess
playing spotify:track:7jLbTp3qZzah9kMIdW8e5M "Ghetto Gospel" [2:29 / 3:58] zoneId=2

The playback continues progressing in the background until the track finishes at 10:46:43.

Immediately afterward, Soloist starts the next Spotify track:

10:46:44.376 Input|SoloistTrack
[accountId="Lars Höfer" uri=spotify:track:0smyCrJiibi2uwCiq5R1vj zoneId=2] soloist is playing a track for this zone

10:46:45.786 Audio|Manager
[source=spotify ... title="Save Tonight" zoneId=2] playback started

Interestingly, Sonn also detects TV Audio around the same time:

10:46:45.867 Zones|StateController:Sonos
[audiotype=3 mode=stop sourceName="TV Audio" title="TV Audio" zoneId=2] sonos state update

But shortly afterward, the Sonos state switches back to Spotify:

10:46:48.371 Zones|StateController:Sonos
[mode=play sourceName="Save Tonight" title="Save Tonight" zoneId=2] sonos state update

My suspicion: Although the Sonos speakers correctly switch to TV Audio, the Spotify/Soloist session isn't actually being paused or released. It continues playing in the background, and when the next track starts, Sonn takes control of the speakers again.

The expected behavior would be exactly what you described in your previous comment: once TV Audio takes over, Spotify should be paused and should not trigger another playback until I explicitly start something again.

I've attached the screenshot and debug log in case they help.

Thanks again for your work on this!

IMG_6567

lars909 avatar Nov 15 '26 10:11 lars909

Thanks for testing, and good to hear grouping works again. Your log showed what was still wrong with TV audio: your soundbar reports TV audio as stopped (mode=stop), and sonn only treated a different source as a takeover when the speaker reported it as playing. So Spotify kept running and the next track took over the speakers again.

TV audio and line-in now count as a takeover whatever state the speaker reports. Spotify gets paused and stays that way until you start something yourself. It's in the dev build that's building now. Could you try again?

rudyberends avatar Nov 15 '26 11:11 rudyberends

Thanks for the quick update! I've tested the latest dev build again, but unfortunately the original issue is still there. There's also a new problem with the fixed group.

1. TV Audio no longer stops Spotify on the entire fixed group

When I turn on the TV, the soundbar correctly switches to TV Audio. However, the second speaker (Gäste-WC) now continues playing Spotify.

Previously, both speakers stopped playing music when TV Audio was activated. That's the behavior I'd like to keep.

Could you restore this, or is the new behavior intentional? I wouldn't want to manually stop the other speaker every time I turn on the TV. Alternatively, maybe this could be made configurable in Sonn's settings?

2. Spotify still interrupts TV Audio when the next track starts

The original bug is still reproducible:

  1. Spotify is playing on both speakers.
  2. I turn on the TV.
  3. The soundbar switches to TV Audio, but Gäste-WC continues playing Spotify.
  4. When Spotify advances to the next track, both speakers switch back to Spotify.
  5. TV Audio becomes silent.

3. Interesting findings in the debug log

At 13:36:48, Sonn receives a pause command for zone 3 (Gäste-WC), but Sonos rejects it:

13:36:48.375 LoxoneHttp|Processor
[command=audio/3/pause] command received

13:36:48.385 Zones|StateController:Sonos
[action=pause message="Command failed: groupCoordinatorChanged" zoneId=3] sonos command failed

I'm not sure whether this is related, but it might explain why the second speaker keeps playing.

Spotify also clearly continues running on zone 2 (Wohnbereich). At 13:37:17, Soloist advances to the next track:

13:37:17.260 Audio|SoloistProcess
playing spotify:track:1ofhfV90EnYhEr7Un2fWiv "Changes" [0:00 / 4:29]

13:37:17.262 Input|SoloistTrack
[zoneId=2] the engine wandered off; this track is over

Shortly afterward, Sonn starts another Spotify track and sends playback to Sonos:

13:37:19.041 Input|SoloistTrack
[zoneId=2] soloist is playing a track for this zone

13:37:20.089 Audio|Manager
[source=spotify title="Save Tonight" zoneId=2] playback started

13:37:20.090 Zones|Manager
[action=play outputCount=1 outputTypes=["sonos"] zoneId=2] dispatchOutputs

At 13:37:23, Sonos reports Spotify playback again:

13:37:23.266 Zones|StateController:Sonos
[mode=play sourceName="Save Tonight" title="Save Tonight" zoneId=2] sonos state update

So it looks like the Spotify session is still active and the next track is triggering playback again, despite TV Audio having taken over.

Expected behavior:

  • Turning on the TV stops/pauses Spotify across the entire fixed group.
  • The soundbar plays TV Audio.
  • Gäste-WC remains silent.
  • Spotify stays paused until I explicitly start music again.
  • Subsequent Spotify tracks must not interrupt TV Audio.

Thanks again for your continued work on this!

lars909 avatar Nov 15 '26 13:11 lars909

Thanks, that groupCoordinatorChanged line was the clue.

When the TV comes on, the soundbar leaves the Sonos group and Sonos hands the group over to Gäste-WC, which carries on with the music. sonn lost track of that reshuffle: it never saw the soundbar switch to TV audio, so Spotify kept running and its next track took the speakers back. That's also why your pause on Gäste-WC was refused: it went to a group that no longer existed.

What's changed in the dev build that's building now:

  • While sonn is playing on a Sonos speaker, it asks the speaker every few seconds which source it's on. If that's TV audio or line-in, Spotify stops and stays stopped until you start something yourself.
  • If the soundbar was leading a group, the other speakers in the group stop as well, so Gäste-WC goes quiet together with the TV coming on.
  • A command Sonos refuses because the group moved is sent again after sonn reconnects.

Could you try again?

rudyberends avatar Nov 15 '26 13:11 rudyberends

One more thing for the next test: if it still goes wrong, please attach the full debug log as a file, covering everything from starting Spotify until the TV audio gets interrupted. Please don't post selected lines. The cause usually sits in lines that look unrelated, like the ones from the Sonos groups reshuffling, and those get left out of an excerpt.

rudyberends avatar Nov 15 '26 14:11 rudyberends

Unfortunately, I've tested your latest fix, but the issue is still there.

When I switch to TV Audio in Wohnbereich, Spotify still isn't properly stopped. The second speaker in my fixed group (Gäste-WC) also continues playing Spotify instead of stopping.

As soon as the next track starts, Spotify takes over both speakers again, including the soundbar, interrupting TV Audio.

I've attached the full debug log, as requested. Hopefully this helps identify what's still going wrong.

sonn-core-logs-2026-11-16T10-12-54-710Z.txt

lars909 avatar Nov 16 '26 10:11 lars909

Thanks for the full log, that helped. There's a new fix in the dev image, could you give it a try? If it still goes wrong, please attach the full debug log again.

rudyberends avatar Nov 16 '26 12:11 rudyberends

Good news! I've tested the latest fix, and it's finally working as expected! 🎉

TV Audio now takes over correctly, Spotify stops across the fixed group, and the soundbar no longer switches back to Spotify when the next track starts. Thanks a lot for fixing this!

There's just one small remaining bug:

  1. When I turn on the TV, music stops in Wohnbereich and the soundbar switches to TV Audio.
  2. Music also stops in Gäste-WC, as expected.
  3. However, after about 1–2 seconds, Spotify briefly starts playing again in Gäste-WC.
  4. After a few more seconds, playback stops again, and Gäste-WC remains silent.

So the final state is correct, but there's a short, unwanted interruption where music resumes in Gäste-WC before stopping again.

It's only a minor issue now, but it would be great if we could eliminate that brief playback as well.

Thanks again for your great work and the quick fixes!

sonn-core-logs-2026-11-16T22-11-41-728Z.txt

lars909 avatar Nov 16 '26 22:11 lars909

Great to hear, thanks for testing. The log showed what happens with Gäste-WC: when the soundbar leaves for TV, Sonos makes Gäste-WC a group of its own and it carries on with the stream. Our stop still went to the old group, so it reached the soundbar instead. That's fixed in the dev image now. Could you give it one more try?

rudyberends avatar Nov 17 '26 08:11 rudyberends

Unfortunately, I've tested the latest dev image, but the behavior is still exactly the same.

When I turn on the TV, music stops in Wohnbereich and the soundbar switches to TV Audio correctly.

In Gäste-WC, Spotify initially stops as well, but after about 1–2 seconds, it starts playing again for a few seconds before finally stopping.

So the end result is correct, but there's still this brief period where Spotify resumes playing in Gäste-WC.

I also noticed that the volume in Gäste-WC seemed unusually loud during this brief playback. I'm not sure if that's related or just a coincidence, so I'll pay closer attention to it during my next test.

sonn-core-logs-2026-11-17T19-02-54-542Z.txt

lars909 avatar Nov 17 '26 19:11 lars909

Thanks, the log showed why. Our stop still reached the old group because Sonos hadn't finished moving Gäste-WC into a group of its own. Now Gäste-WC is stopped the moment it shows up playing on its own. That's in the dev image, could you try once more? The louder volume is probably related: on its own, Gäste-WC plays at its own volume instead of the group's.

rudyberends avatar Nov 18 '26 09:11 rudyberends

A bit of background, so you know what to expect. I don't own a Sonos myself. The whole Sonos support is built from reference code and feedback from users like you, and every fix in this issue was made purely from your logs. None of it has been tested on a real speaker before it reaches you. So it's quite possible that a fix doesn't work the first time. That's just how it goes with this setup, and your tests and full logs are exactly what gets us there. Thanks for sticking with it.

rudyberends avatar Nov 18 '26 09:11 rudyberends

Unfortunately, I've tested the latest dev build again, but the issue is still there. I've attached the latest debug log.

And please don't worry about the iterative approach! I completely understand that it's difficult to develop and debug Sonos support without having actual Sonos hardware available for testing.

I really appreciate the time and effort you're putting into this. :-)

sonn-core-logs-2026-11-18T17-56-02-898Z.txt

lars909 avatar Nov 18 '26 17:11 lars909

Thanks for the log and for sticking with it. It showed exactly what happens: when the soundbar goes to TV, Sonos makes Gäste-WC a group of its own, and it picks up our stream with about ten seconds already buffered. sonn noticed within a third of a second and sent a stop four times, but each one went to the old group, because the view it had of the speakers was a step behind. So Gäste-WC played until its buffer ran out. Now the stop also goes straight to Gäste-WC itself, by its own address. That's in the dev build. If it still plays on, the log will now say whether that stop got through.

rudyberends avatar Nov 28 '26 17:11 rudyberends

Great news – everything is now working perfectly! 😊

I've tested the latest dev build, and the behavior is exactly as expected.

Thank you very much for your persistence, patience, and all the effort you've put into fixing this issue. I really appreciate it!

I've also attached the latest debug log in case it's helpful.

One small observation, just FYI: When opening sonn on the dev build, I received an error notification in the upper-right corner saying that the status could not be read (401). I'm not sure what caused this or whether it's related, but I thought it was worth mentioning.

Other than that, everything worked perfectly. Looking forward to the next beta release! 🚀

sonn-core-logs-2026-11-29T18-16-48-280Z.txt

lars909 avatar Nov 29 '26 18:11 lars909