In adding Sonos support to a touchscreen console I have built (see A pi based control console I originally built for an ISY hub and which now supports HA as well) I noticed some things that might be easily fixable in the Sonos component. First is that there is no way to update the source list (i.e., the Sonos favorites) without entirely restarting HA. It may be that soco doesn’t push an indication of such a change to HA so it can’t be done automatically, but it would seem that a sonos specific refresh service call might be added. That would at least be less disruptive than an entire restart. I also noticed that for Sonos devices that support source of TV or Line-in these are not listed in the source list. It looked like they should be since there is specific code to check if the player is, e.g., a Playbar. This may be a bug but one that I could work around except that the model of the Sonos speaker is not a reported attribute. It appears that you get the model info from soco at start up but you don’t make it available as an attribute. It would be nice to do so since then I could at least do the check and add TV or Line-in as sources when appropriate. Note that despite these values not being listed as sources, they work correctly if you use them a inputs in a set source service call.
So I looked a bit into the source code and the missing TV and Line-in sources issue is that there is a small bug in the Sonos component code around line 877. The strings that are searched for are all upper case (CONNECT and PLAYBAR specifically) but the model strings are not. These search strings should be “Connect” and “Playbar” to match what the current Sonos firmware seems to return. I don’t have a Play:5 so I can verify that is also wrong but I’d guess it is. I’m not currently rigged up to try to change the HA code but perhaps someone who is could look at fixing these?
Fixing the updating of the favorites list is still something I’m looking at to see if there is a simple fix or workaround to make that not require the restart of the HA server.
Thanks for reporting this though you are more likely to get bugs fixed by submitting them as GitHub issues. This must be a recent firmware change since my Sonos still reports “CONNECT”.
I rarely edit my favorites so I never had an itch to make the source list update automatically.
Thanks. I almost posted it on the github page but being new to this community I wasn’t quite sure about the protocols preferred here. Interesting that is was such a recent change though I figured it probably was pretty recent since others hadn’t seen it. I don’t edit my favorites too often either but my wife does and the console control of Sonos is aimed at her. She’d have no chance if I told her to restart the HA server when she made a change!
Use GitHub issues for bugs and this forum for feature suggestions (though suggestions rarely get implemented as we are all volunteers).
Since you know Python, it would be great to get you on board so you can fix bugs yourself
Just FYI - noticed that the changes had been merged into development so I grabbed the new version and dropped it into my system and the changes worked like a charm. Thanks again. I’ll keep an eye out for where I might contribute in the future. As a retired guy from a long tech career, much in research software, I’m always looking for interesting brain stimulants.
Kevin