Sync volume of Sonos speakers in a group

Hi community,

If you’re like me and have a bunch of Sonos speakers around the house, one thing that might bother you is the lack of volume synchronization feature. You change the volume of one speaker, and that only affects that one speaker, even if it’s part of a group. The only alternative is to open the app or use a voice command.

This simple automation fixes the issue.

Unfortunately you need to list all of your Sonos speakers by hand as the state trigger doesn’t seem to support templates.

- alias: "Sonos: Sync volume of group members"
  trigger:
    - platform: state
      entity_id:
        - media_player.your_sonos_speaker_1
        - media_player.your_sonos_speaker_2
        - media_player.your_sonos_speaker_3
      attribute: volume_level
  condition: []
  action:
    - action: media_player.volume_set
      data:
        volume_level: "{{ state_attr(trigger.entity_id,'volume_level') }}"
      target: 
        entity_id: |
          {{ expand(trigger.to_state.attributes.group_members) | map(attribute='entity_id') | list }}
  mode: single
  max_exceeded: silent

Hope this is useful to someone!

4 Likes