Since 2105.00 I can no longer play radiostations on Sonos

After upgrading to 2021.5.2 my breakfast script starting the coffee-maker, kettle and tuning the Sonos system to play a news station no longer works.
I have used the following to play radio station “P1” (added as a favorite in Sonos):

service: media_player.select_source
data:
  source: P1
target:
  entity_id: media_player.kok

Everything else Sonos-related works in the automation - TTS announcing “Good Morning”, joining players, setting volumes etc.
Do I need to do anything different now in 2021.5.x?
Thanks,
/Mattias

P.S On version 2021.5.2 D.S

Actually, nothing from the Sonos favourites play anymore. I see them in the Source drop-down:

+1, I have an alarm that plays bbc radio 6 in the morning and for the past week or so that stopped working. Manually triggering doesn’t work either and I don’t see many errors in the logs that could help.

I don’t have an answer but what’s in your log? I got a lot of Sonos related errors lately. Maybe something broke in the integration

Nothing Sonos-related in the logs. Where should I look?

which version are you using? I have 2021.5.1 and everything works fine

As I put in the OP - 2021.5.2.

ah sorry. I missed it.
i can see a change in the 2021.5.2

so not sure if this might broke it

Enabled debug for the sonos integration and find this, no errors.
Could perhaps make sense to anyone reading? Seems like there is some activity on github around sonos integration so keeping fingers crossed.

192.168.16.135 is my Associated Product and the rest are players. All on Sonos S2 and using SonosNet through a Boost.

2021-05-11 11:06:59 DEBUG (Sonos-Discovery) [homeassistant.components.sonos] Reached _discovered_player, soco=<SoCo object at ip 192.168.16.135>
2021-05-11 11:06:59 DEBUG (MainThread) [homeassistant.components.sonos.speaker] Async seen: <SoCo object at ip 192.168.16.135>, was_available: True
2021-05-11 11:06:59 DEBUG (Sonos-Discovery) [homeassistant.components.sonos] Reached _discovered_player, soco=<SoCo object at ip 192.168.16.130>
2021-05-11 11:06:59 DEBUG (MainThread) [homeassistant.components.sonos.speaker] Async seen: <SoCo object at ip 192.168.16.130>, was_available: True
2021-05-11 11:07:00 DEBUG (Sonos-Discovery) [homeassistant.components.sonos] Reached _discovered_player, soco=<SoCo object at ip 192.168.16.133>
2021-05-11 11:07:00 DEBUG (MainThread) [homeassistant.components.sonos.speaker] Async seen: <SoCo object at ip 192.168.16.133>, was_available: True
2021-05-11 11:07:00 DEBUG (Sonos-Discovery) [homeassistant.components.sonos] Reached _discovered_player, soco=<SoCo object at ip 192.168.16.134>
2021-05-11 11:07:00 DEBUG (MainThread) [homeassistant.components.sonos.speaker] Async seen: <SoCo object at ip 192.168.16.134>, was_available: True
2021-05-11 11:07:00 DEBUG (Sonos-Discovery) [homeassistant.components.sonos] Reached _discovered_player, soco=<SoCo object at ip 192.168.16.132>
2021-05-11 11:07:00 DEBUG (MainThread) [homeassistant.components.sonos.speaker] Async seen: <SoCo object at ip 192.168.16.132>, was_available: True
2021-05-11 11:07:00 DEBUG (Sonos-Discovery) [homeassistant.components.sonos] Reached _discovered_player, soco=<SoCo object at ip 192.168.16.131>
2021-05-11 11:07:00 DEBUG (MainThread) [homeassistant.components.sonos.speaker] Async seen: <SoCo object at ip 192.168.16.131>, was_available: True

Some fairly significant changes were made to Sonos in 2021.5.0, and a few fixes were added in 2021.5.2.

If I understand correctly, you can see favorites as before, but selecting one to play using HA has no effect? If you start using the Sonos app does everything work as expected?

The log messages above are all normal.

If I understand correctly, you can see favorites as before, but selecting one to play using HA has no effect? If you start using the Sonos app does everything work as expected?

Correct.
From Sonos app (macOS, iPad, iPhone) all works fine.

1 Like

Checking further - I see I can start and stop playback from HA. HA also picks up what is playing.


What I cannot do is select a new source to play (i.e. from my Favorites, for example the P1 radio station).

Hmm, I can reproduce in 2021.5.2, but not in the development branch I’ve been running daily. Let me see what’s different in this service.

3 Likes

It appears that the internal favorites list is somehow populated twice, which means it doesn’t know what to do when it gets redundant matches. Not sure why yet, but at least the cause is known.

1 Like

Attempting a fix here: Hotfix for Sonos favorites race condition by jjlawren · Pull Request #50495 · home-assistant/core · GitHub.

1 Like

Quick testing with 2021.5.3 reveals that it is working! Well done!

1 Like

Just tested my alarm with 2021.5.3 and that works again too! Great job, thanks for the quick fix.

1 Like

2021.5.3 introduced this bug for my Symfonisk, the favorites list being doubled and unable to play any of them through the cards or media_player.select_source service.

I rolled back to 2021.5.2 which had fixed the cards not being updated with the current state.

THEN I checked my Sonos software for an update and there was one (It feels like I updated it like a week ago). With the latest Sonos update (13.1 build 63288230) 2021.5.2 would not play favorites, but upgrading to 2021.5.3 got it all working again.

I have a suspicion that the favorites doubling issue has a small chance of still happening in 2021.5.3 even after the fix. I couldn’t reproduce the problem in my own setup but perhaps it’s still possible to occur under some race condition. If it does happen again, please try restarting HA and see if that resolves it.

On a side note, the current state of the integration in dev (which will be in 2021.6) is quite different and somewhat simpler/cleaner. It got a bit messy adding the new sensors for 2021.5 as the integration wasn’t originally built to handle multiple platforms. It’s feeling much better now after a rework in dev and I’m running side-by-side to monitor for any other possible issues.

Anyway, sorry for the rough ride. I’m trying my best to improve the integration and appreciate the feedback and patience.

Hmmm… Just got Sonos 13.1 installed overnight and now the issue is back on some players even with HA 2021.5.3. Noticeable our Arc (with two One as surround speakers) and an old Play:3 have problems to start playing from HA.