Help with Sonos_join please

Please could someone help with the sonos_join service settings.

I hope that I expect it to work as I think it will - that is, when used it groups the speakers first and then lets you play media on the group rather than individual speakers all playing the same music (through group.speakers) which can cause timing issues across the speakers.

I have set a script to automate on the press of a minimote button and tried:

long_press_1:
  alias: "long_press_1"
  sequence:
    - service: media_player.sonos_join
      master:
        - media_player.dining_room
      entity_id:
        - media_player.dining_room
        - media_player.lounge
        - media_player.kitchen
    - service: media_player.play_media
      entity_id: media_player.dining_room
      data:
        media_content_id: hls-radio://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/llnw/bbc_radio_two.m3u8
        media_content_type: music

but get the following error:

Invalid config for [script]: [master] is an invalid option for [script]. Check: script->script->long_press_1->sequence->0->master

If I remove the master section, I get:

Invalid service data for media_player.sonos_join: required key not provided @ data['master']. Got None

I am sure it is something simple but the Sonos components page doesn’t really expand on it with an example.

Im getting there…

Changed the script to:

long_press_1:
  alias: "long_press_1"
  sequence:
    - service: media_player.sonos_join
      data:
        master: media_player.dining_room
      entity_id:
        - media_player.dining_room
        - media_player.lounge
        - media_player.kitchen
    - service: media_player.play_media
      entity_id: media_player.sonos_join
      data:
        media_content_id: hls-radio://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/llnw/bbc_radio_two.m3u8
        media_content_type: music

Which now groups two rooms together (Dining Room and Kitchen) but does not start any music playing…

I think… in the service media_player.play_media you have to call the master that you have declared in the service media_player.sonos_join

- service: media_player.play_media
  entity_id: media_player.dining_room
  data: 
    media_content_id: hls-radio://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/llnw/bbc_radio_two.m3u8
    media_content_type: music

Fabrice, thank you - I knew that it would be something simple!