Group Sonos Speakers Automation

Hi all,

I am trying to create an automation that does the following:

  • Group two Sonos speakers
  • Set the volume to 12%
  • Play a radio station

I have the following script now, but I get the error: Message malformed: extra keys not allowed @ data[‘sequence’][0][‘mode’]

Do you know what I need to change to make it work? Thanks in advance!

sequence:
  - service: sonos.join 
    data:
      master: media_player.woonkamer
      entity_id:
        - media_player.eetkamer
  - service: media_player.volume_set
    target:
      entity_id: media_player.woonkamer
    data:
      volume_level: 0.12
  - service: media_player.play_media
    target:
      entity_id: media_player.woonkamer
    data:
      media_content_id: http://icecast-qmusicnl-cdp.triple-it.nl/Qmusic_nl_live_96.mp3
      media_content_type: music
mode: single

are you sure that the “mode: single” part of the above code is actually indented as shown?

the above looks OK but it’s complaining that “mode” isn’t valid option for “sequence”. So I would assume that you need to check the indentation of “mode:…” in the actual script code.

Hi,

replace

sonos.join 

with

media_player.join

merry christmas

Thanks for the reply! When I change the script to the code below I get a different error: extra keys not allowed @ data[‘master’]. Got None required key not provided @ data[‘group_members’]. Got None

Do you know what I need to change?

  - service: media_player.join
    data:
      master: media_player.woonkamer
      entity_id:
        - media_player.eetkamer
  - service: media_player.volume_set
    target:
      entity_id: media_player.woonkamer
    data:
      volume_level: 0.12
  - service: media_player.play_media
    target:
      entity_id: media_player.woonkamer
    data:
      media_content_id: http://icecast-qmusicnl-cdp.triple-it.nl/Qmusic_nl_live_96.mp3
      media_content_type: music

It now works with the following script:
Thanks for your help!

  - service: media_player.join
    data:
      entity_id: media_player.woonkamer
      group_members:
        - media_player.eetkamer
  - service: media_player.volume_set
    target:
      entity_id: media_player.woonkamer
    data:
      volume_level: 0.12
  - service: media_player.play_media
    target:
      entity_id: media_player.woonkamer
    data:
      media_content_id: http://icecast-qmusicnl-cdp.triple-it.nl/Qmusic_nl_live_96.mp3
      media_content_type: music