EDIT 8Jan2024: Near complete re-write "finished". Removed ALL code related to anything "Cloud". New version runs 100% locally. Does NOT require any sort of 'Sonos Developer' account to function. It's 100% local, using a combination of UPnP commands and an unpublished local API. At some point, Sonos may lock down access to either or both of these, but what little information I could find on the matter seems to indicate they have zero intention of removing local control, so at worst there might be some fixes needed if/when that day occurs. Additionally, as I don't have any S1-only devices available for testing, I can't say for sure if there's any issues with this code regarding S1-only devices.
Now, on to the app itself! How is this different than the built-in app for Sonos? Well, a few ways:
First, it has NON-INTERRUPTING TTS. The built-in app has buttons for "Play Text And Restore", however this does NOT restore. It doesn't restore if you use the Sonos app to start whatever was playing originally from your favorite streaming service. It doesn't restore if what you were playing originally was an AirPlay stream. Maybe it restores if you're playing a playlist of locally stored MP3, I don't know, I haven't tried it, and I don't have a folder of MP3s to test with. Presumably most people use streaming music services, so I'd assume that for most people it doesn't restore.
'Sonos Advanced' does. Well, it doesn't actually even stop in the first place. It just lowers the volume of what is playing, does the TTS announcement, then restores the volume. The TTS can (optionally) be at a different volume than whatever is play, too. Unlike my previous version, this also works 100% locally. Any command with "And Resume" or "And Restore" uses the non-interrupting method.
"Play Track" and "Set Track" do not. They use "SetAVTransportURI" to start playing. I've tested this on local files, such as "http://192.168.1.4/local/doorbell.mp3", and to works as expected. Uris that start with "x-rincon" or "x-sonosapi" or "x-sonos" still need addressed. These require "CurrentURIMetaData" being sent during the UPnP command, which causes most of them to fail. I'm looking into ways to handle this, such as submitting a basic "metadata template" with them so the command will succeed. I'm also working on creating "Snapshot" child devices for the Player device, which would 'snapshot' the 'CurrentURI' and 'CurrentURIMetaData' as it is currently playing on the player, which should allow for restoring many/most streams. This is WIP with no estimated date of completion, assuming I can get it working at all.
All of the TTS related commands all use the non-interrupting method, even if they don't say "And Resume". So "Play Text" and "Play Text And Restore" both do the exact same thing. I don't see any real reason to have a TTS interrupt the stream since it's running locally anyway. If someone has a request to make "Play Text" interrupt, I can change this.
Secondly, my app allows for the creation of "Grouping Devices", which are just as they sound. You can select a "coordinator" and one or more "followers" and it'll make a virtual group device. This group device has a couple of buttons on it. One will group up all the players you selected, and this will create NEW group from scratch, ending anything that might have been playing on ANY of the players. Another button is "join players to coordinator" which does just that, joins them and they will play whatever the coordinator is playing, in a Sonos group. Then there's "remove players from coordinator" which will remove ALL players, but keep the coordinator playing, and an "ungroup players" which removes everything, coordinator included, from all groups. This, like the "group players" button, ends anything that's playing, on coordinator and all.
The "Sonos Advanced Group" devices now also have "switch" capability on them, so you can more easily call them in a Rule. And to make this even better, the switch reflect current state of the group. If the speakers are grouped exactly as set up in the Group Device, the switch will be "on". This means the selected coordinator needs to currently be the coordinator, all of the follower devices need to be in the group, and no other devices can be in the group. It doesn't matter how the group is created, whether through the Sonos Advanced app on HE, through any of the Sonos official apps on phones, computers, or any other method. If the group is set properly, the switch is "on", otherwise it's "off". This should hopefully open up some fun new possibilities for automation.
Each of the Virtual Sonos Advanced Player devices also have a button on them for "Ungroup Player", which will remove that player from whatever group it is in. If there's currently something playing, and the player you remove from the group is the "coordinator" then one of the other players in the group will end up as the coordinator.
Thirdly, the Sonos Advanced Controller allows for the enabling/disabling of "Crossfade" and setting the repeat mode to "All", "One", or "Off". Additionally, I've added optional child devices for each player device, giving on/off switch control for crossfade, shuffle, "repeat one", and "repeat all". I'll be adding a few more of these, too, for mute and a few other things. They're optional and off by default. Both the "current state" for these and control are available via the main "Sonos Advanced Player" device, with no need to create the child devices. They're 100% optional.
Lastly, but not least, the Sonos Advanced Controller has a button for "Load Favorite", which allows you to automate the loading of a Sonos Favorite. This can be anything that's a Sonos Favorite, whether that be a single song, a playlist, album, etc. And there's a "Get Favorites" button, which will fetch all your favorites, with album art, and display the name, album art, and favorite number, so you can easily figure out what favorite number you want. Now, I have a few dozen favorites, and this works well for me. If you have hundreds of Sonos Favorites, I don't know how it'll work... please let me know if anyone tries it with hundreds of favorites. I expect it should work fine, but I haven't tried it with a very large favorites list.
Sonos Advanced is on HPM for easy installation and updating. Enjoy and please feel free to provide feedback here or put in pull requests or issues on GitHub.