I would probably create an input_select with an entry for each of your Sonos speakers, then use it in the UI in combination with the lovelace template card to conditionally render a mini-media-player card of the selected Sonos speaker.
You could then easily switch between your Sonos speakers and leave → recreate the Sonos group with the desired master.
A better but probably more advanced solution would be to use a similar input_select but have a script fired when an item (a new master) is selected, the script calls media_player.sonos_join with the entity_id parameter as the current value of the sonos_group attribute and the master parameter as the selected item (Sonos).
Could also skip the input_select and achieve the same thing through this cards shortcut option, but would probably need to create a script for each Sonos…
Yes, I’ve addressed some of the things you brought up earlier.
The underline of the shortcut list dropdown is gone, there’s a new label option for the list dropdown, the default label was changed to “Shortcuts…” and shortcut support for sound_mode of course.
I couldn’t figure out an appropriate name for this option, soooo…it’s simply called attribute right now and goes inside the shortcut option object. Do you have a better name for it?
Thank you Kalkih, your first option worked, granted it might not be the optimal way to do it but it gets the job done really well (but the code in the card feels… endless :-)).
What this does
When you select your sonos it will display the selected player that allows you to group your sonos speaker with what you selected as the master. This reduces the cards needed to one and it takes a bit less real estate on screen.
So in short in case anyone else want to go at it, this is what I have done:
I decided to use the vertical-stack-in-card and then work with conditions to decide what card to display depending on what you select in the input_select.
Download and add the javascript for the vertical-stack-in-card:
Yes, the config gets rather bloated. If you’d like, you could get rid of all conditional cards and leverage the lovelace template card on a single mini-media-player card to render the selected entity.
Hey,
Everything seems to be working fine without any changes on my end, at least on my system.
If you change your tts setup to google_translate manually or are on a fresh setup you might have to change the card config slightly, specifically the platform option from google to google_translate if I understand the docs correctly.
The card automatically adds “_say” to the end of the tts platform you specify (except for the custom tts platforms that require different service calls to work).
Actually not sure, I’m not up to date on how custom_updater handles things nowadays, it’s been a while since I last used it and I know there have been some major changes to it. Check out the custom_updater docs.
I don’t use custom updater but I was getting errors (object not supported) with the mini player js file in a subdirectory of /www. Works fine in /www.
It’s the only custom card I have that seems to require this.
It shouldn’t require being in the root, it should make no difference as long as your resource reference points to the correct location of the bundle and it’s inside of /www of course.
If you continue having issues like that make sure the file isn’t corrupt and/or file/directory permissions aren’t screwed up.
This option to send variables to a script looks promising but I’m a little unsure how to use it. I have the below script where it grabs info from some input_select menu’s. Is it possible to create a shortcut button which sends: 1) the speaker group, and 2) the media_content (as per the last 2 options in my script) to the script in one hit? That would be awesome!