finally… rather then call out indiviaully entities, could you have a group?
then every time you add a new Sonos speaker, you can add it to the group and it will flow into this?
You set it in the script so you’re sure that in the following steps you’re talking to the master and not to a slave spreaker. That’s also the reason they are first unjoined and then joined again.
media_player.living_room is a group containing 2 speakers. They are merged by Sonos because they are in the same room.
HomeBee, my use case was slightly different, but my dumbed down solution might help you, if you’re still looking.
I’m running both S1 and S2 Sonos systems in the house so considered adjusting this to serve the file to both an S1 group and an S2 group, but the S1 and S2 grouping speeds seem a bit different and variable depending on what combination of speakers are grouped at the time, so the sync wasn’t ever going to be perfect with the mix of the two systems.
Since that’s the case, I decided not to worry about the sound being sync’ed at all.
My script dumbed down the original and removes the joining of different rooms and just defines the speakers (a mix of S1 and S2) that I want the sound to play on as a comma separated list in the entity_id: each time it is referenced. e.g.
It works well and the sync is only a bit out. The main aim was to hear the door bell in key rooms throughout the house, so job done.
I haven’t had the inclination to test if this might be quicker than joining all the speakers into their S1 and S2 groups and then playing the sound through the two groups, but I wonder if this way each speaker starts playing the chime when it’s ready, rather than waiting for the slowest speaker to group up before playing. Dunno.
There seems to be an issue with using local media now through Sonos. There is another thread somewhere on it, I don’t have the link to hand sorry.
I got around this by using my NAS as a media server connected to Sonos, put my local files in there, and then added them to the Sonos app. Lastly created a playlist and then added just the file to that playlist. I then call the playlist instead of the file direct.
Seems that most people suggest setting up the sounds you want to play in a SONOS playlist through SONOS app and then playing then from HA. There must be a better way.
To be honest I have even lost the basic sounds, such as a door opening, that I had playing on Google Home speakers.
I can see the files in Media Browser and I can even play them from there on the Googel speakers, not the SONOS.
Any suggestions? I presume the issue is the media_content_id, but I really cannot work out what value to use. Once I have this working I will go back to SONOS.
Made a little bit of progress using the Sonos app for OSX. I was able to create a Sonos media library and upload my mp3 file to the Sonos media library. I can now see the Sonos Media library when I select a Sonos speaker from the Home Assistant media library by clicking “Choose Player” in the upper right hand corner. Still can’t figure out how to select that file as a source when trying to build an automation though.
@magicbenny how are you uploading your files. If I attempt to use either the Media Management or the File Editor the uploads fail because the files are too large. Is there some place to increase the upload file size.
@magicbenny actually I have discovered a few issues to work through with uploading and using files with the Media Management. When using the Nginx SSL Proxy add-on there is a file size issue not present when using the standard HTTP access and port. I need to track down or open up an issue for the add-on in this regard.
@Dizzwold I am successfully using the Local Media folder. The only problem I’ve run into with it is uploading files when using the Nginx HA SSL Proxy. If I connect to my HA without going through the SSL proxy I can upload the sound files no problem to the Local Media folder. I haven’t had a chance to dig in farther with the Nginx Proxy to find a solution. Here is an example of what I have in my alarm script.