Join Sonos speakers using media_player.join

In 2022.8 there were breaking changes for joining Sonos speakers. We are now supposed to use media_player.join. But how do I list more than one entity in JSON now when I need to set group_members in the data field in NR?

click the load example data button, it should load this

{
   "group_members":"- media_player.multiroom_player2\n- media_player.multiroom_player3\n"
}

image

Thanks, but I can´t get that one to work either. With the string

{
   "group_members":"- media_player.sovrum\n- media_player.vardagsrum\n"
}

I get the API Error

Call-service error. Entity ID - media_player.sovrum
- media_player.vardagsrum
 is an invalid entity ID @ data['group_members'][0]

What am I missing?

I think that is a typo, try

{
  "group_members": [
    "media_player.sovrum",
    "media_player.vardagsrum"
  ]
}
2 Likes

That did work, thanks @Mikefila

Hi, now i try to solved problem with media_player.join sonos speakers. If I join next speaker into group, it will be stoped playing. Do you know somebody how to solving? Grouping is succesfull but, playing is stoped.

entity_id: media_player.symfonisk_loznice - this I want to connected

data in node:

{
   "group_members": [
    "media_player.symfonisk_obyvak_stereo",
    "media_player.symfonisk_kuchyn_stereo"
  ]
}
{
  "group_members": [
    "media_player.symfonisk_obyvak_stereo",
    "media_player.symfonisk_kuchyn_stereo"
  ]
}

spacing

1 Like

Spacing wasn´t my problem, but thanks for correct. After adding next speaker, are groups renamed. Before was - “obyvak+1” after “loznice+2” I think that is problem.

Old variant call service - sonoss.join was working right.

If you use the older script.say type variant for Sonos speakers you’ll need to update the script section to use the media_player.join service and also the group_members variable:

    - service: media_player.join
      data_template:
        group_members: "{{ where }}"
        entity_id: "{{ master }}"

And the resulting automation array variable change:

      data_template:
        variables:
          master: 'media_player.office'
          where: '["media_player.chalkboard_room","media_player.kitchen","media_player.loft","media_player.office"]'

I ran into this problem. In order to join next speaker without stopping playback you have to keep the same master speaker. The master speaker is the first speaker listed in group_members. To join another speaker add the new speaker to group_members list but keep entity_id the same as the previous group of speakers

Can you give an example of the statement you are using? I want to add a speaker to a group, found via {{state_attr(“media_player.sonos_keuken”, “group_members”)}}
Have tried:
service: media_player.join data: group_members: "{{state_attr("media_player.sonos_keuken", "group_members") + [ "media_player.sonos_toilet"] }}" target: entity_id: {{state_attr("media_player.sonos_keuken", "group_members").0}}
But that gets “invalid entity id”

Now I using sonos-universal node from this pallete: node-red-contrib-sonos-plus (node) - Node-RED

Setting this node, is on screen: