Google Speaker Group Volume Control in Script/Automations

Hey. I’m stumped. I gone through:

HowTo: Control Group Volume on Google Home / Nest Speakers (SONOS patent lawsuit)

and

Google Cast Integration - Removing Speaker Group Volume Controls?!? Jan 2022

but have not been able to solve this… I’m hoping people smarter than I have some ideas.

I have a script that runs spotcast to play sleep playlist in my daughters room. They have 3 Google speakers that were/ are in a group. I know Google killed the group volume control and that has messed everything up.

But this is where I have hope/ am confused.

  1. While my script no longer sets volume for media_player.girls_room the lovelace entity card’s volume control still works.

  2. When I play through spotcast to a group (so they are all in sync), individually adjusting each devices volume through a script or automation also doesn’t seem to work?

sleep_sounds:
  alias: Plays the Rain Playlist
  sequence:
  - service: spotcast.start
    data:
      entity_id: media_player.girls_room
      uri: spotify:playlist:###########
      random_song: true
      shuffle: true
  - delay:
      seconds: 20
  - service: media_player.volume_set
    target:
      entity_id: media_player.girl1_hub
    data:
      volume_level: 0.6
  - service: media_player.volume_set
    target:
      entity_id: 
        - media_player.girls_bedroom_wifi
        - media_player.girl2_hub
    data:
      volume_level: 0.4

Nothing happens here. no speaker change… it doesn’t even seem to try.

If I change the volume_set back to the speaker group the hubs display the volume, but do not change it. Again, I can go to the lovelace card and adjust the slider to change the speaker group as a whole.

Ideally, I’d prefer to individually adjust the speakers volume as one daughter likes it louder than the other, but would be happy with a way to adjust the overall volume of the group.

The same thing happens when I try and remove the volume change from the script and move it to an automation that calls the script. Any Idea’s?

Does it work if you go to developer tools → call service and set the same things? Should be working. At least it’s for me.

Individually this works, but the group volume does not change when I set volume from dev tools. Immediately after trying I went back to the group entities card and tested it and it worked perfectly… I can even send the text to speak and it plays through all of the speakers.

There’s obviously a way for this to work, but I don;t know how to see the code of what is actually happening through the lovelace card (assuming that would even help me)!

FWIW, the Lovelace card seems to use the Google Cast integration… looking at the documentation, I am not sure how that helps me as Google Cast doesn’t support Spotify or have built in volume controls.

So… I think I got it. AND… I think I am an idiot.

My automation includes a mute at the beginning to stop the annoying beeps from the speakers as volumes change and casts start. I assumed (wrongfully) that setting the volume would override the mute. It doesn’t seem so. I have added an unmute at the end of the automation and now all individual speakers return to their settings in the script.

2 Likes